(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
09-21-24 05:06 AM
0 users currently in Programming.
Acmlm's Board - I3 Archive - Programming - PCRE
  
User name:
Password:
Reply:
 
Options: - -
Quik-Attach:
Preview for more options

Max size 1.00 MB, types: png, gif, jpg, txt, zip, rar, tar, gz, 7z, ace, mp3, ogg, mid, ips, bz2, lzh, psd

UserPost
Boom.dk
Posts: 18/356
Umm... I'm using it in PHP...

? - extends the meaning of (, also 0 or 1 quantifier, also quantifier minimizer

Since * is a quantifier, ? probably minimizes it (making it un-greedy)... or something like that.
MathOnNapkins
Posts: 65/1106
I'm not even sure if that would work given you have two special symbols together. i.e., the *? combination. I can't remember if you can do that but I seem to recall some special combinations, however this link says otherwise. http://www.opengroup.org/onlinepubs/007908799/xbd/re.html

The behaviour of multiple adjacent duplication symbols (+, *, ? and intervals) produces undefined results.

So in conclusion either my memory is making stuff up, or what is valid depends on the library of regular expression software you are using. I've seen it vary from Python to Perl, to Microsoft, to Java. Actual treatment of symbols seems fairly uniform but sometimes has glaring differences.
Boom.dk
Posts: 17/356
Ok thanks but I figured it out. The thing with the quantifier minimizer, that is.

If you had like... a string... umm like... "yes! this is a string" then "t.*s" would prolly eat "this is a s" while "t.*?s" would only eat "this".

...I think. Lol.
MathOnNapkins
Posts: 59/1106
It picks up 0 or 1 occurences of a particular group.

So if you had the regex: "(3?)(5)(4+)"

It would pick up: "35444......" or "5444....." where .... indicates infinitely many 4's.

Thus it means the 3 is optional but if it does see it it makes sure to grab it.

? is shorthand for {0,1} (zero to one occurences). You can use curly braces for abitrary bounds, like {5,7} (five to seven occurences)

I myself needed a small refresher so this is where I made sure I knew what I was talking about: http://www.tote-taste.de/X-Project/regex/syntax.html
Boom.dk
Posts: 15/356
What does "quantifier minimizer" (the ? ) mean? What does it do?
Acmlm's Board - I3 Archive - Programming - PCRE


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.003 seconds; used 346.12 kB (max 380.61 kB)