Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • 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
 
jnfsmileCommented:
Well,
/\d{4}/

Open in new window

?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
jnfsmileCommented:
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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