Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

php reg match

hello there,
how can I preg match these even when the numbers change?
|1920|1200";</script>

Open in new window

0
XK8ER
Asked:
XK8ER
1 Solution
 
Cornelia YoderArtistCommented:
Why do you want to use preg?  What are you trying to do, there might be a simpler way.
0
 
XK8ERAuthor Commented:
because im making a script.
0
 
jnfsmileWeb DeveloperCommented:
Well,
/\d{4}/

Open in new window

?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
jnfsmileWeb DeveloperCommented:
or, if you meant the whole thing
/\|\d{4}\|\d{4};"\<script\>/

Open in new window

0
 
XK8ERAuthor Commented:
/\d{4}/ matched these and its incorrect.

1920|1200";</script>
(e029a7af)";</script>
0
 
mankowitzCommented:
@infsmile

Just a typo -- you need to include the slash before the word script

The regex you want is:

/\|\d{4}\|\d{4}";\<\/script\>/
0
 
Terry WoodsIT GuruCommented:
What's the result you want? Do you want the 2 numbers separately? If so, you'll want to use preg_match_all
0
 
XK8ERAuthor Commented:
you also have to put \ before "
I got it now..
0
 
XK8ERAuthor Commented:
this worked
/\|\d{4}\|\d{4}\";\<\/script\>/
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now