Jump to content

Reg Exp


Chikwado

Recommended Posts

Some one help view this: I was hoping that this script would work, It some how behave as it work. code This is what want to do with that script: In textarea I will type my bla bla phrase then in the text field i will type regexp pattern and the script will pass the match to new div. Ok, for example if i type "hello world" in the textarea i will type this

/world/i;
to match world. Then it stop working. But if i remove this character
//i;
it start to return the match Edited by Chikwado
Link to comment
Share on other sites

The text is just a string, not a regular expression pattern. If you type "/world/i;", then it is looking for "/world/i;", not "world" with the i modifier. You can try to parse the text to get the delimiters, pattern, and flags and then create a RegExp object and pass that to match.

 

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp

Link to comment
Share on other sites

You can parse the text to get the delimeter, pattern and flags and create regular expression object

I don't know how to do that, Can you help me do it? I like to type my phrase in the textarea and input pattern in text field to match some word.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...