Log in

View Full Version : Help me with PHP eregi_replace()!


xuanmanh
Jun 1, 2006, 09:19 PM
I want to search within a string for substrings which contain "src=" and does not contain "some" next to it.
For example this substring "src=thingsome" should match and this "src=something" shouldn't.

Can you tell me how to do this?

LTheobald
Jun 2, 2006, 01:30 AM
I don't have PHP on this PC so I can't test this at the mo but try:

src=(?(?!some)(.*))
I've got a feeling this will work with preg_replace but not ereg_replace or eregi_replace.

Also some useful links for you:
http://www.regular-expressions.info/quickstart.html
http://www.weitz.de/regex-coach/

xuanmanh
Jun 2, 2006, 09:07 PM
Thank you for your recommendation, I'll check the links to find more