Regex to match repeated patter after a string -


i need regex extract pattern after specific word (her limits::)

i have teststring ,so let's text between delimiter !limits::****! :

*ksjfl kfj sdfasdfaf dfasf asd sdf dfasd fdaf ad f afdfaf dfad bla bla ksfajs ldsfskj !limits::wlo1/whi1/whi1/whi1,wlo2/whi2/whi/whi2,.hier repeated pattern..,wlon/whin/clon/chin! fasdfakl skdfkas sflas fasf sdf afasf

i want words :

  1. wlo1
  2. whi1
  3. whi1
  4. whi1
  5. wlo2
  6. whi2
  7. whi
  8. whi2
  9. .
  10. .
  11. .
  12. wlon
  13. whin
  14. clon
  15. chin

i have tested (?:!\w+::(?:(\w+)/(\w+)/(\w+)/(\w+)))|(?:,(\w+)/(\w+)/(\w+)/(\w+))+.*!, fail

regular expressions:

/(w.*|c.*)(?=\/|!|,)/g : match words beginning w or c followed / , !, or ,

/\/|,.*(?=,)|,/ : remove / or , or characters followed , or , string returned first regexp

var str = "*ksjfl kfj sdfasdfaf dfasf asd sdf dfasd fdaf ad f afdfaf dfad bla bla ksfajs ldsfskj !limits::wlo1/whi1/whi1/whi1,wlo2/whi2/whi/whi2,.hier repeated pattern..,wlon/whin/clon/chin! fasdfakl skdfkas sflas fasf sdf afasf";    var res = str.match(/(w.*|c.*)(?=\/|!|,)/g)[0].split(/\/|,.*(?=,)|,/);    document.body.textcontent = res.join(" ")


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -