Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

preg_match, getting the string index of a match.

Status
Not open for further replies.

zoomby

Programmer
Aug 5, 2002
60
DE
hi,

preg_match:
imagine you have a string "hello world", and search for the substring "world" via preg_match. how can I found out the location where the substring was found?
The result of the string above should be 7, because "world" begins with character number 7.

My goal is to show a small portion of a big string around a matched substring.

bye
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top