17-07-2008
Group items without saving backreference
Section:
regex
If you want to group some items in a regular expression, but don't want to have save it for later use, put a ?: after the (
eg:
source text: test1.gif test2.png test3.jpg
To match a filename with only gif and png extensions:
/(.*?\.(?:gif|png))/
this wil match : test1.gif, test2.png
without the ?: this would match: test1.gif, gif, test2.png, png
Sections
-
PHP
(1)
-
General
(2)
-
Ruby on Rails Snippet
(3)
-
Ruby on Rails
(13)
-
HTML
(1)
-
Css
(1)
-
regex
(1)
-
Photoshop
(1)
-
Leopard
(1)
A little note to Internet Explorer users:
This site is not made for Internet Explorer. Some pages may look like shit. Yes, i could fix it for IE, but no, I'm not gonna do it. Try
Opera
or
Firefox
instead!
Welkom
Guest
|
Login