By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,642 Members | 1,681 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,642 IT Pros & Developers. It's quick & easy.

need help for a regex. thanks a lot!

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
$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

P: n/a
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.