Urgent Yet Easy Help Needed With Preg OFFSET CAPTURE
Posted: Fri Sep 07, 2007 9:31 am
Hi,
I have a search page. Users can type like abnorm[al][al] and it matches both abnormal and abnormla text (regex). The problem is that how do I know how long is the search word? If I use strlen($search) it says 14 characters (abnorm[al][al]), but I need it to be 8 (abnormal) how would I do this? I am using OFFSET CAPTURE in preg match sentence can I somehow include it there?
Search for: te[sx]t
Results: text, test
Length: 7 (SHOULD BE 4!!
)
I have a search page. Users can type like abnorm[al][al] and it matches both abnormal and abnormla text (regex). The problem is that how do I know how long is the search word? If I use strlen($search) it says 14 characters (abnorm[al][al]), but I need it to be 8 (abnormal) how would I do this? I am using OFFSET CAPTURE in preg match sentence can I somehow include it there?
Search for: te[sx]t
Results: text, test
Length: 7 (SHOULD BE 4!!