[Webinar] Streamline your web hosting managementRegister Today

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
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
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

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

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