Regex:
(?<=KEY.{1,99})([0-9]*)
Example text:
test 74488 hdhd2 768 788 KEY bla gjjjcrs 6448. gfudj778. 2 bla 77545 77890 7754
Desired result:
6448
I need only first match of digits group after KEY. Can I make regexp stop searching after first digit group occurrence to reduce CPU load? Or I don't need it?
Use: (.*) (KEY) ([^0-9]*)(\\d+)
If you want to match only those digits after KEY: (?:.* KEY) (?:[^0-9]*)(\\d+)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.