sunnybrad
asked on
Java Regular expression
Hi:
I need Java regular expression help. In a String value I want to extract a substring before the appearance of -d means appearance of first hyphen and digit.
For example:
Test-Test2-2.1.2
I want Test-Test2 value to be extracted.
Look forward to your near response.
Best Regards,
-Sunnybrad
I need Java regular expression help. In a String value I want to extract a substring before the appearance of -d means appearance of first hyphen and digit.
For example:
Test-Test2-2.1.2
I want Test-Test2 value to be extracted.
Look forward to your near response.
Best Regards,
-Sunnybrad
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi for_yan:
I will try it out and let you know.
Best Regards,
-Sunnybrad
I will try it out and let you know.
Best Regards,
-Sunnybrad
Sure, please, try it and let me know.
Yes, but you don't need the character class
s = s.replaceAll("-\\d.*","")
Open in new window
Open in new window