T
Thomas 'PointedEars' Lahn
jc said:The regex in this Javascript is not working to find strings that
start with "(". Escaping the ( and using chr(40) did not work either.
There is no built-in chr().
Nor did double escaping it.
It should work if you lose the chr().
<http://jibbering.com/faq/#posting>
I confirmed strings that match are being sent. And if I change my
match to another character like "-" it works.
How do I do this?
if (strTitle.match("^"+"("))
if (strTitle.match("^\\("))
or
if (strTitle.match(/^\(/))
,-[ECMAScript Language Specification, Edition 3 Final]
|
| 15.5.4.10 String.prototype.match (regexp)
|
| If regexp is not an object whose [[Class]] property is "RegExp",
| it is replaced with the result of the expression new RegExp(regexp).
| Let string denote the result of converting the this value to a string.
| Then do one of the following:
| [...]
Also, once past this, how do I remove (somechangingtext) from the
begging of a string?
s = s.replace(new RegExp(expr));
You will need to escape those characters in `expr' that should not have
their default RegExp meaning, though.
PointedEars