PDA

View Full Version : is regexp() buggy?



sami
05-14-2012, 04:43 PM
Or just limited in functionality?

The expressions:

<b>(.*?)</b>\s*
and

\<br\s*/?\>\s*|<b>(.*?)</b>\s*

fail. Is grouping not allowed? What about or's?

I'm just trying to easily split a string on html <br> and <b>xxxx</b> tags for parsing.

thanks if you have any advice about the implementation of this function in Lscript. :)

sami
05-14-2012, 05:44 PM
Just found out a bug/limitation of lscript's regexp(). It seems \s doesn't work for whitespace characters with regexp(). I have no idea what it does. But you can use [ \t\r\n] in place of \s for whitespace searches/replaces.

sami
05-14-2012, 05:48 PM
Btw, is there any Lscipt way of doing splits on regular expressions? Or do you have to do what I've been doing, which is:
1. Do a search and replace for your token (replace it with a "custom string" that wont be in your source string) then
2. use parse() on the "custom string"