String method to get unknown value that matches regex from string

Posted by Aly on Stack Overflow See other posts from Stack Overflow or by Aly
Published on 2010-03-19T15:55:27Z Indexed on 2010/03/19 16:01 UTC
Read the original article Hit count: 507

Filed under:
|
|

Hi,

In Java is there a way to extract the value of an unknown subset of a string via a regex. For example in the following string "hello world 1234" I want to be able to extract the value 1234 via the regex [0-9]*. Is there a way to do this?

© Stack Overflow or respective owner

Related posts about java

Related posts about regex