-
Reg expression validation using test() and search()
Is there difference in using regexp.test(string) or str.search(regex)? Getting difrnt results when I use one vs to other.
I use sample: http://www.tek-tips.com/viewthread.c...264340&page=10. For input value "tes?t.txt" I get different output when using search method vs test method.
help?
-
rx.test(string) returns true or false, depending on whether there is a match
string.search(rx) returns the index of the first character of a match, or -1
-
thnx, got that in theory. but for this example, i meantioned, outpt is nt right. doesnot behave as per definition.
-
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks