regex - Javascript match and regularexpression -



regex - Javascript match and regularexpression -

i've searched example, i'm bad @ regular expressions need reply specific example. i'm using javascript , have next string example: accountactivitystatus.transactionhistorys.0.activityamt

i need able match given string starts accountactivitystatus , contains number somewhere after that. assistance appreciated:

^accountactivitystatus(?=.*\d).*$

try this.see demo.

http://regex101.com/r/yz7qj6/7

var re = /^accountactivitystatus(?=.*\d).*$/gm; var str = 'accountactivitystatus.transactionhistorys.0.activityamt\naccountactivitystatus.transactionhistorys..activityamt\naccountactivitystatus.transactionhistorys.4.activityamt'; var m; while ((m = re.exec(str)) != null) { if (m.index === re.lastindex) { re.lastindex++; } // view result using m-variable. // eg m[0] etc. }

javascript regex match

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -