0

I have this pattern in over 10.000 places:

11,1,2,0,0,"Lorem ipsum dolor sit amet, 8 - 14. consectetur adipiscing elit. 6 - 13. Aenean semper fermentum ipsum sed vehicula. In commodo sit amet libero et rhoncus. Cras vitae dapibus nisl. Mauris lacinia dui lacus, ut sodales massa congue vel. Donec at 8 - 11. dapibus mi, ullamcorper porttitor orci. Nullam id dui nibh. Fusce est ante, viverra 4 - 7. et cursus vel, scelerisque imperdiet massa. Donec sit amet nibh porttitor, tincidunt lorem in, maximus elit."

I need to capture all 11,1,2,0,0, patterns at the beginning of the sentence AND ALL the 8 - 14. patterns (they have different numbers between dashes - and before the dot .) throughout the sentence using Regex.

How do I do this?

I have tried (^\d*,\d*,\d*,\d*,\d*)+(\d* - \d*\.)

The desired output is:

11,1,2,0,0, 8 - 14. 6 - 13. 8 - 11. 4 - 7.
neowinston
  • 7,584
  • 10
  • 52
  • 83

1 Answers1

2

You can use regex alternation for 2 patterns:

\b((?:\d+,)+|\d+\s*-\s*\d+)

RegEx Demo

anubhava
  • 761,203
  • 64
  • 569
  • 643