Regex 999,99 XY

Hi,

I need Regex for following expression: 999,99 XY.

Explanation:

  • there can be up to 3 digits before comma
  • there can be 1 or 2 digits after comma
  • there can be 1 or more spaces betwen last number and “XY”
  • “XY” are two fixed characters.

Can someone help me, please?
Thx and KR, Vanja

@VanjaV
Try with this regex:
^\d{1,3},\d{1,2}\s+XY$

1 Like

Hi @VanjaV

You can try below regular expression:
[0-9]+[,]?[0-9]+\s*[A-Z]{2}

Hope it helps!!

1 Like

Hey @VanjaV can you try with this syntax

System.Text.RegularExpressions.Regex.Match( STRINPUT,“^\d{1,3},\d{1,2}\s+XY$”).ToString

cheers

1 Like

Hi @VanjaV

You can use the below regular expression to achieve every point you mentioned,

\d{1,3}\,\d{1,2}\s*XY

→ \d{1,3} - It will extract one to three digits before comma
→ , - Extracts comma
→ \d{1,2} - It will extract one or two digits after comma
→ \s* - It will extract the spaces between digits and XY (Space will be one or more)
→ XY - It will extract XY (It is static everytime)

Hope it helps!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.