-1

I'm trying to search and delete some Data from the csv. file at once, with the Sublime Text 3 program. I can't find the right one, and can't put one together, that works.

It shoud found: UVP: 59,99 or UVP: 159,99

1 Word: UVP 1 symbol: ":" 1 space between UVP: and 59,00 or 159,99 and 2 or 3 digits, then comma and 2 digits

The list:

UVP: 32,99 UVP: 324,42 UVP: 321,33 UVP: 19,99

Any ideas how to build some regular expresion?

John Cloud
  • 25
  • 6

1 Answers1

0

the regex is UVP:\s\d{2,3},\d{2}

with perl it looks like this:

echo "UVP: 32,99 UVP: 324,42 UVP: 321,33 UVP: 19,99" | perl -ne 's/UVP:\s\d{2,3},\d{2}/-/g;print'
- - - -

Explanation of the regex:

UVP: matches the characters UVP: literally (case sensitive)
\s matches any whitespace character (equal to [\r\n\t\f\v ])
\d{2,3}
matches a digit (equal to [0-9])
{2,3} Quantifier — Matches between 2 and 3 times, as many times as possible, giving back as needed (greedy)
, matches the character , literally (case sensitive)
\d{2}
matches a digit (equal to [0-9])
{2} Quantifier — Matches exactly 2 times
Global pattern flags
g modifier: global. All matches (don't return after first match)
Oliver Gaida
  • 1,078
  • 3
  • 9