Jump to content


Photo

HeLp?


  • Please log in to reply
4 replies to this topic

#1 Eugene

Eugene
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 09 August 2006 - 12:01 AM

Hey all, I need a regular expression, and seeing as my regexbuddy demo expired, anyone have any other regex application?

Also the regex i need is it has to match a specific word.

For example...

preg_match_all('/'.$string.'/', 'whatever', 'whatever', ...);

Instead of matching that particular word, I need it to also match 50 characters after that word. If there aren't 50 character it matches whatever is there.

Thanks.

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 09 August 2006 - 12:11 AM

preg_match_all('/' . $string . '.{0,50}/',......
follow me on twitter @PHPsycho

#3 Eugene

Eugene
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 09 August 2006 - 12:32 AM

preg_match_all('/' . $string . '.{0,50}/',......


I'll try that.

Edit: It does work, sorry :$.

#4 Eugene

Eugene
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 09 August 2006 - 11:53 AM

preg_match_all('/' . $string . '.{0,50}/',......


I'll try that.

Edit: It does work, sorry :$.

How can I also match UP TO 50 characters before that.

#5 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 09 August 2006 - 01:38 PM

'/.{0,50}' . $string . '.{0,50}/' should do the trick
follow me on twitter @PHPsycho




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users