Jump to content

HELP!


jnvnsn

Recommended Posts

$subject = "Hilton Newark Penn Station Fl 1, 1 Gateway Ctr, Newark, NJ 
(973) 622-5000 hilton@yahoo.com";
$pattern = '~^([\w\d\s,]+)(\(\d{3}\s*\d{3}-\d{4}\))~';
preg_match($pattern, $subject, $matches);
foreach($matches as $match){
    print "$match matches the pattern";
}

Link to comment
Share on other sites

 

 

^([\w\d\s,]+)(\(\d{3}\)\s*\d{3}-\d{4})

 

Options: ^ and $ match at line breaks; free-spacing

 

Assert position at the beginning of a line (at beginning of the string or after a line break character) «^»

Match the regular expression below and capture its match into backreference number 1 «([\w\d\s,]+)»

  Match a single character present in the list below «[\w\d\s,]+»

      Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»

      A word character (letters, digits, and underscores) «\w»

      A single digit 0..9 «\d»

      A whitespace character (spaces, tabs, and line breaks) «\s»

      The character “,” «,»

Match the regular expression below and capture its match into backreference number 2 «(\(\d{3}\)\s*\d{3}-\d{4})»

  Match the character “(” literally «\(»

  Match a single digit 0..9 «\d{3}»

      Exactly 3 times «{3}»

  Match the character “)” literally «\)»

  Match a single character that is a “whitespace character” (spaces, tabs, and line breaks) «\s*»

      Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»

  Match a single digit 0..9 «\d{3}»

      Exactly 3 times «{3}»

  Match the character “-” literally «-»

  Match a single digit 0..9 «\d{4}»

      Exactly 4 times «{4}»

 

 

Created with RegexBuddy

Link to comment
Share on other sites

Not free.

 

Extremely useful. For an amateur coder? Perhaps not, but if you're a professional, the $40 pays for itself VERY quickly.

you recommend it i'm guessing? I use regex alot so anything that can cut down on my brain power time is a good thing..lol...what is the functionality, what all can you do with it?

Link to comment
Share on other sites

There used to be a trial. To be honest, I used a cracked version when I was first learning, but purchased not long after.

 

Here's a page with demos of what it can do

http://www.regexbuddy.com/demo.html

 

I'm a HUGE supporter of really trying before you buy, and you can easily find a somewhat recent version in the usual popular places to try. I do NOT support piracy, though - if you do that and decide you don't want to pay, please uninstall.

 

I mostly use it for it's debugging features. Helps you make faster expressions, and see where the engine is backtracking.

Link to comment
Share on other sites

There used to be a trial. To be honest, I used a cracked version when I was first learning, but purchased not long after.

 

Here's a page with demos of what it can do

http://www.regexbuddy.com/demo.html

 

I'm a HUGE supporter of really trying before you buy, and you can easily find a somewhat recent version in the usual popular places to try. I do NOT support piracy, though - if you do that and decide you don't want to pay, please uninstall.

 

I mostly use it for it's debugging features. Helps you make faster expressions, and see where the engine is backtracking.

cool, thanks man

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.