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

online demo

/(\d{8})(.*?)training complete/g 
  • g stands g lobal. matches , not on first match

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -