简体   繁体   中英

How can I repeat a match in a regular expression?

This is probably stupidly basic, but I can't find the solution for the life of me. (Yes I've already search SO for answers.) I have the following regular expression: /([^0-9.]+)/ and when run against the string '53624.4sadca4234foobar.234' , it matches 'sadca' but not the 'foobar' . I want it to match any character that is not a number or decimal point.

What is the correct way of doing this?

What you need is usually called "global matching". I don't know what programming language do you use, but most of the have different facilities for returning the first match and for returning all matches. If you tell us the programming language you can help you with that.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM