Jump to content

HELP!


jnvnsn

Recommended Posts

$subject = "Hilton Newark Penn Station Fl 1, 1 Gateway Ctr, Newark, NJ 
(973) 622-5000 [email protected]";
$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
https://forums.phpfreaks.com/topic/242450-help/#findComment-1245244
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
https://forums.phpfreaks.com/topic/242450-help/#findComment-1245902
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
https://forums.phpfreaks.com/topic/242450-help/#findComment-1245918
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
https://forums.phpfreaks.com/topic/242450-help/#findComment-1245921
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
https://forums.phpfreaks.com/topic/242450-help/#findComment-1246123
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.