I have a label, which contains text. I need to get the two text elements which are separated by ” – “. How can I do this with regular expressions in jQuery?
Share
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.
I would advise to use split rather than a regular expression. You can get both elements by using
string.split(" - ");. This will return a string array with the elements split at the ” – “.