Java regex for currency symbols

In this post, we will see about regex to find currency symbols in a text.

You can use below regex to find currency symbols in any text.

\\p{Sc}

Each unicharacter belongs to certain category and you can search for it using /p. Sc is short code for current symbol, so using \p{Sc}, we are trying to find currency symbol in a text.

Output:

Start index: 24 End index: 25 : $
Start index: 34 End index: 35 : ₹

That’s all about regex for currency symbols in java.

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *