For example, for this string,
div.img-wrapper img[title="Hello world"]
I want to match the first space but not the second space (which is enclosed in []). What is the regex?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The following expression will do the job by using a look ahead assertion.
The underscore represents a space. This expression does not support nested brackets because regular expression are not powerful enough to express nested matched structures.
UPDATE
Here is another (and more beautiful) solution using a negative look ahead assertion.
It asserts that the next bracket after a space is not a closing bracket.