Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
The stuff after trailing slashes in regexps
filburt1
Join Date: Feb 2002
Posts: 6,144

Maryland, US
by filburt1 filburt1 is offline 25 May 2003

It took quite a bit of research, but here's what those characters after regular expressions mean:
  • i: case-insensitive
  • c: effectively means return what doesn't match the expression
  • m: don't ignore whitespace differences
  • s: ignore multiple lines when using the match chars (*, ?, +, etc.)
  • x: allow whitespace and comments (for readability)
  • U: don't be greedy
I still can't figure out what U does (vB uses //siU everywhere), but those five are the common ones.

Last edited by filburt1; 31 Jul 2003 at 19:59..
Views: 2497
Reply With Quote
Comments
  #2  
Old 25 May 2003, 03:44
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
What does the i do in siU?
Reply With Quote
  #3  
Old 25 May 2003, 03:45
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Case-insensitive (stupid JS-based vB code generator...)
Reply With Quote
  #4  
Old 25 May 2003, 12:17
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Re: The stuff after trailing slashes in regexps

Today at 05:16 AM filburt1 said this in Post #1
I still can't figure out what U does (vB uses //siU everywhere), but those five are the common ones.
U specifies "greediness". Roughly that is whether search returns the largest matched pair or the smallest, if there are more than 1 matches.
__________________
Logician's Blog | WebTemplates for vb 4.x : VB Integrated Content Management System
Reply With Quote
  #5  
Old 25 May 2003, 14:10
filburt1 filburt1 is offline
 
Join Date: Feb 2002
But isn't .? used for that (rather than .*)?
Reply With Quote
  #6  
Old 25 May 2003, 17:07
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Say you have this text:
aaaaa
[bbb]
ccccccccccccc
[bbb]
dddddddddddd
[/bbb]
eeeeeeeee
[/bbb]
ffffffffffff
and you are trying to match chars between [bbb] tags. Would your regular expression return:
dddddddddddd
or:
ccccccccccccc
[bbb]
dddddddddddd
[/bbb]
eeeeeeeee
that is what greediness parameter specifies.
__________________
Logician's Blog | WebTemplates for vb 4.x : VB Integrated Content Management System
Reply With Quote
  #7  
Old 25 May 2003, 17:08
filburt1 filburt1 is offline
 
Join Date: Feb 2002
I know what it means, I mean that isn't that what the ? operator is used for rather than the * operator?
Reply With Quote
Reply

Similar Article
Article Author Type Replies Last Post
PHP Tag Slashes String Parsing Fix Boofo vBulletin 2.x Full Releases 14 16 Jun 2004 08:48



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 03:57.

Layout Options | Width: Wide Color: