I don't know where else to turn for help with regex, so I turn to you. Consider the following:
------------------------ ONCE (twice) Three times a lady. Not as much as the Gambler. (This sucks) How would you know? ------------------------
How do I match the 2nd line but not the 5th? How do I match the 6th, but not he 3rd?
Is this possible?
P.S. Do you guys have any really good references for regex (aside from the manuel), where I can hunt down problems like this?
On Feb 21, 2006, at 11:30, Oliver Taylor wrote:
I don't know where else to turn for help with regex,
There's freenode#regex.
so I turn to you. Consider the following:
ONCE (twice) Three times a lady. Not as much as the Gambler. (This sucks) How would you know?
How do I match the 2nd line but not the 5th? How do I match the 6th, but not he 3rd?
What is different in each case? The presence of ONCE exactly in the line before?
P.S. Do you guys have any really good references for regex (aside from the manuel), where I can hunt down problems like this?
You could read the Perl tutorials, there's some Perl there of course, but just a minimum:
$ perldoc perlrequick $ perldoc perlretut
There's a handy quick reference as well (with some Perlisms):
$ perldoc perlreref
I don't know whether TM supports the most "advanced" idioms, but in any case it will help you to get started for sure.
-- fxn
On Feb 21, 2006, at 2:42 AM, Xavier Noria wrote:
On Feb 21, 2006, at 11:30, Oliver Taylor wrote:
I don't know where else to turn for help with regex,
There's freenode#regex.
so I turn to you. Consider the following:
ONCE (twice) Three times a lady. Not as much as the Gambler. (This sucks) How would you know?
How do I match the 2nd line but not the 5th? How do I match the 6th, but not he 3rd?
What is different in each case? The presence of ONCE exactly in the line before?
Indeed, I'm uncertain what the logic behind the matches is supposed to be. Is the second line matched because of the sequence of cardinal numbers, a parenthetical following a line of all capital letters, a parenthetical with only one word, a parenthetical with no capitalized letters, a parenthetical followed by a statement... and so on.
P.S. Do you guys have any really good references for regex (aside from the manuel), where I can hunt down problems like this?
You could read the Perl tutorials, there's some Perl there of course, but just a minimum:
$ perldoc perlrequick $ perldoc perlretut
There's a handy quick reference as well (with some Perlisms):
$ perldoc perlreref
I don't know whether TM supports the most "advanced" idioms, but in any case it will help you to get started for sure.
-- fxn
Textmate, in my understanding, uses the Oniguruma [1] regular expression library. The reference [2] summarizes the supported constructs and character classes.
There's also a section in the manual comparing the differences between Oniguruma and Perl's regex engine.
Paul Knight
[1] http://www.geocities.jp/kosako3/oniguruma/ [2] http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt