regular expressions: finding a character o the end of string
Let's say I have a string (btw: this is a refferer to my site):
I'm using this code to get the "q" value, trying to make the query bolded:
But it doesn't work when "q" is the last value, that is when string is:
How do I get the "q" value, that is a string between "q=" and the end of the string?
The above should work.
Note that I also changed your "(.*?)" with "([^&]*)" since ".*" is not very effective. Also, the "?" mark at the end of your is also not useful since ".*" means zero or more and the question mark allows it to be zero, i.e. redundancy in the regexp.
Hope it helps,
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread