468,296 Members | 1,270 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,296 developers. It's quick & easy.

need help for a regex. thanks a lot!

The pattern is required as:

"Item purchased: [text, can be many workds] (Item #[at least 10 digits
number])"

Here is an example:

"Item purchased: Intel Pentium IV 3G CPU (Item #23467893452)"
Thanks in advance!

Alex

Jul 17 '05 #1
2 1352
$string = "Item purchased: Intel Pentium IV 3G CPU (Item #23467893452)";
if (preg_match("/Item purchased: ([\w\s]+) \(Item
#(\d{10,})\)/",$string,$array)) {
print "<pre>";
print_r($array);
print "</pre>";
}

"Alex Shi" <ch****@stonix.com> wrote in message
news:ny******************@nntp-post.primus.ca...
The pattern is required as:

"Item purchased: [text, can be many workds] (Item #[at least 10 digits
number])"

Here is an example:

"Item purchased: Intel Pentium IV 3G CPU (Item #23467893452)"
Thanks in advance!

Alex

Jul 17 '05 #2
Thanks!
$string = "Item purchased: Intel Pentium IV 3G CPU (Item #23467893452)";
if (preg_match("/Item purchased: ([\w\s]+) \(Item
#(\d{10,})\)/",$string,$array)) {
print "<pre>";
print_r($array);
print "</pre>";
}

"Alex Shi" <ch****@stonix.com> wrote in message
news:ny******************@nntp-post.primus.ca...
The pattern is required as:

"Item purchased: [text, can be many workds] (Item #[at least 10 digits
number])"

Here is an example:

"Item purchased: Intel Pentium IV 3G CPU (Item #23467893452)"
Thanks in advance!

Alex


Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by bill tie | last post: by
8 posts views Thread by moondaddy | last post: by
1 post views Thread by hillcountry74 | last post: by
9 posts views Thread by jmchadha | last post: by
4 posts views Thread by Morgan Cheng | last post: by
7 posts views Thread by Jordi Rico | last post: by
6 posts views Thread by Gary Bond | last post: by
15 posts views Thread by morleyc | last post: by
6 posts views Thread by | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.