Page 1 of 1

Regular expressions question

Posted: May 9th, 2010, 5:17 am
by ehcelino
Hi guys, my question may sound a bit silly but Im new to regular expressions. I understand the working of the expression itself, but my question is about the (?siU) part. I know what ?siU means, but are there another commands that I can use there? I've seen commands such as RegExp="(\r\n|\n), but I don't know what it does. Is there a tutorial that covers this part of the commands (the parenthesis part)? I've browsed around, but found nothing. If anyone could help, I'd appreciate it!

Re: Regular expressions question

Posted: May 9th, 2010, 2:11 pm
by poiru

Re: Regular expressions question

Posted: May 10th, 2010, 3:23 am
by ehcelino
Actually I did, but it still doesn't explain about the regexp(????) part. My guess is that those are commands to the regex parser, but where do I find those commands?

Re: Regular expressions question

Posted: May 10th, 2010, 4:58 am
by dragonmage
http://www.sdsc.edu/~moreland/courses/IntroPerl/docs/manual/pod/perlre.html
http://www.regular-expressions.info/quickstart.html

Some places to look, the perl docs in particular as that is the RE that Rainmeter uses.

Re: Regular expressions question

Posted: May 10th, 2010, 5:51 am
by ehcelino
Thank you guys, I found what I was looking for in this page: http://www.sdsc.edu/~moreland/courses/I ... erlre.html

:-)

Re: Regular expressions question

Posted: May 10th, 2010, 12:42 pm
by poiru
ehcelino wrote:Actually I did, but it still doesn't explain about the regexp(????) part. My guess is that those are commands to the regex parser, but where do I find those commands?
Yes it does.
What is this ?siU stuff?

The "?s" tells RegExp to ignore "line breaks" when doing a search. That way if you search for "Every good boy deserves favor" and it is split on two lines in the output, it will still match.

The "i" tells the search to be "case insensitive". Matches will work on both upper and lower case.

The "U" tells RegExp to be "ungreedy", meaning that it will return only the first instance of the match on the search string.