javascript - Regex for finding a specific pattern in a string -
I want to write a regex if a string has But if I try to use the pattern: for testing You can call The best way to do this really depends on you. If you just want to check that In the string, If you really want to use a regex, you can If you really Want to use regex and If you select If you want to check two If you have a ]] [[. For pre:
[[T]] [[T]] .
RegExp (/] \] \ [? = \ [\ [] /)
[[t]] [[t]] , console displays unknown ')': < P>
Why do you have a syntax error:
( to
\ ( , so you have
unmatched '' '' in the error
\ (? = \ [\ []
How to fix it:
]] [[[/ code>, do not use a regex:
if (yourString.indexOf (')] [[' ']] == -1 ) {// do something}
[ s but
] to avoid s:
if (/ $] <<< =. Test ((its string)) {// do something}
[[:
[[ and
]] (like
[[ T]] ):
if (/ \ [[[[[[[[\\]] *]] /. Test (your string)} {// do something}
[[..]] string back-to-back:
if (/ [SA [[[^ [\]] *]] / test (your string)} {// do something}
If you want to check for [[.. ..]] string, then after the exact same string (
[[t]] [[t]] but not
[[foo]] [[bar]] ):
if (/ ([[[[[^ [[]] *]]) \ 1 / .test (yourS Tring) together with a group of unit tests to show how each of them does the work
Comments
Post a Comment