thturk
thturk

Reputation: 86

Regex to get values combined with "-" or "/" in Java

I want to get some element in address string for example

"Örnek Mah. Deneme Sk. No:24/8 Ankara"

an address can be like this and i want to get 24/8 or it can combined with '-' also some combination of combined values

"b-10","b/150","1256-b"

digit part can be more than one but char part is only one letter.

thanx for your help...

Upvotes: 0

Views: 32

Answers (1)

Muhammad Hassan
Muhammad Hassan

Reputation: 505

You can use this pattern

(\d+[/-]\d+)|(\w+[/-]\w+)

Upvotes: 1

Related Questions