doubledee
10-07-2012, 08:15 PM
Below is a PHP Regex that someone helped me create...
if (preg_match_all('/\\{url=([a-zA-Z0-9-]+)\\}/', $body, $matches, PREG_SET_ORDER) !== false){
Questions:
1.) Why are there double back-slashes before the left and right braces?
2.) How would I change this to say, "Match all instances where the vakue in between the Curly Braces is a Lower-Case Letter, Upper-Case Letter, Number, or Hyphen and is between 2 and 20 characters in length"??
3.) How would I modify this Regex to look for references to images in my "Article Body", where an Image could be either a PNG, JPEG, JPG or GIF?
Here is my best guess...
if (preg_match_all('/\\{img=([a-zA-Z0-9-]+)[.png|.jpeg|.jpg|.gif]\\}/', $body, $matches, PREG_SET_ORDER) !== false){
Thanks,
Debbie
if (preg_match_all('/\\{url=([a-zA-Z0-9-]+)\\}/', $body, $matches, PREG_SET_ORDER) !== false){
Questions:
1.) Why are there double back-slashes before the left and right braces?
2.) How would I change this to say, "Match all instances where the vakue in between the Curly Braces is a Lower-Case Letter, Upper-Case Letter, Number, or Hyphen and is between 2 and 20 characters in length"??
3.) How would I modify this Regex to look for references to images in my "Article Body", where an Image could be either a PNG, JPEG, JPG or GIF?
Here is my best guess...
if (preg_match_all('/\\{img=([a-zA-Z0-9-]+)[.png|.jpeg|.jpg|.gif]\\}/', $body, $matches, PREG_SET_ORDER) !== false){
Thanks,
Debbie