Jump to content

pattern syntax with preg match


ahs10

Recommended Posts

i have a text string in which i would like to assign all the numbers after a particular string to a variable, stopping when it gets to a space.  i'm having trouble with the pattern syntax.

 

if the string i was searching for was "&RECORD_ID=123456789 ", what would i use?  i want all the numbers contained between the equal sign and space.

 

also, i can't find a good quick reference guide for this pattern syntax.  php.net does a great job of explaining the preg_match function, but i'm having trouble grasping the pattern syntax explanations.

 

any help is much appreciated.

Link to comment
Share on other sites

i could, if i had control over the server the url was hosted on.  i'm parsing a remote page which contains that url.  the string i'm searching is the source code of the page.

 

if you have the time, can you explain the syntax of the pattern?  what does '/RECORD_ID=([0-9]+)/i' do?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.