Javascript Searching a pattern
Hi all
here is my problem,
I have a text area in html page containing a long html code.
like
some code
.....
.......
<input type="text" name="mobile" value="1234567890"/>
some code
.....
.......some code
.....
.......
From that code present in the i need to extract following line
I want to write a java script Function which will search the entire code find the pattern
debasishgang7
Junior Poster in Training
91 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
Well thanks for reply but the problem is the text is not the element of the page!So in my case i cant access that item like this.how can i find that using regular expression ??
debasishgang7
Junior Poster in Training
91 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
Actually I am pasting the whole code into that text area.
I am trying to make script if some one click a button it will search the text field and extract the phone number from that code pasted in textarea.
....
....
code code code \
more code more code
.....
....
......
please let me know if m not clear.
debasishgang7
Junior Poster in Training
91 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
Something like this probably.
result = subject.match(/<input type="text" name="mobile" value="(.*?)"\/>/g);
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
Well Thanks a lot pritaeas its working fine but its returning the whole line :
I just want to get the Number in this case it should return 1234567890!!
debasishgang7
Junior Poster in Training
91 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
Something like this probably.
result = subject.match(/<input type="text" name="mobile" value="(.*?)"\/>/g);
Well Thanks a lot pritaeas its working fine but its returning the whole line :
I just want to get the Number in this case it should return 1234567890!!
debasishgang7
Junior Poster in Training
91 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
Hmz... it should return an array.
See this page , first example (exec). Perhaps that'll work.
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875