Extract multiple strings using regex -
i want extract multiple strings 1 string based on regex.
example:
input string :
20140909 sample string 1 training complete useless string training complete useless string 2 training complete useless string 2 training complete 20120206 sample string 2 training complete
i want extract strings between date string , training complete string.
expected output of above string following 2 strings
20140909 sample string 1 training complete 20120206 sample string 2 training complete
regex using: (\d{8})(.*?)training complete gives first required string, want required strings.
you need use global modifier g
/(\d{8})(.*?)training complete/g
g
stands g lobal. matches , not on first match
Comments
Post a Comment