I have been trying to use regex to replace the height and width paramters of a you tube embedded video. I have successuflly managed to get the regex to replace the first instance of the height and width, however it wont change the second instance. I am using the gi flags to replace globally and ignore case .
As you will see in the code below i have also tried to replace the values for a second time in case the g flag wasnt working
I don't know if there are any regex experts on here, so I doubt this forum will be of much help. Have a look at regexr though, awesome site. And if nobody can help you here, I'm sure the folks at stack overflow can be of assistance.
Just found this while doing some matching, you probably solved it months ago, but for anyone else, it's because the 'g' flag for the Exslt replace function works the wrong way round:
<xsl:value-of select="regex:replace(string('a b c a b c'), 'a', 'i', '1')"/>
gives: 1 b c 1 b c
<xsl:value-of select="regex:replace(string('a b c a b c'), 'a', 'ig', '1')"/>
regex in xslt
I have been trying to use regex to replace the height and width paramters of a you tube embedded video. I have successuflly managed to get the regex to replace the first instance of the height and width, however it wont change the second instance. I am using the gi flags to replace globally and ignore case .
As you will see in the code below i have also tried to replace the values for a second time in case the g flag wasnt working
The html that gets outputted from the above is
If i remove the disable-output-escaping then i can see that the html being outputted is
Any help is much appreciated
I don't know if there are any regex experts on here, so I doubt this forum will be of much help. Have a look at regexr though, awesome site. And if nobody can help you here, I'm sure the folks at stack overflow can be of assistance.
Thanks for you reply, once i have found an answer will post it here as well
Just found this while doing some matching, you probably solved it months ago, but for anyone else, it's because the 'g' flag for the Exslt replace function works the wrong way round:
<xsl:value-of select="regex:replace(string('a b c a b c'), 'a', 'i', '1')"/>
gives: 1 b c 1 b c
<xsl:value-of select="regex:replace(string('a b c a b c'), 'a', 'ig', '1')"/>
gives: 1 b c a b c
The 'i' flag works as expected.
is working on a reply...