Jump to content

convert ereg to preg_match


qualsiasi

Recommended Posts

Hello, I tried to check preg_match syntax for be able to convert my pattern from ereg to preg_match function, but i have some problem understanding preg_match pattern building.

 

Can someone help me? The pattern i need to convert is this:

 

ereg("([0-9]{4}).([0-9]{1,2}).([0-9]{1,2})", $data[$nn], $regs)

 

its a simple date check loop, i would like to:

 

preg_match("...........................", $data[$nn], $regs)

 

Thanks in advance.

Link to comment
Share on other sites

Thanks a lot rhodesa, solved.

 

@aschk: as far i had to edit a important script not wrote by me, that write sensible data on DB, where there is many of this call, i wonted to risk to do mistake by simple add basic slash, because after i saw some perl pattern example, i found it more complex and then i was not sure it was really right.

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.