0

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?

Zargontapel
  • 298
  • 1
  • 2
  • 12
  • 1
    Well those would be two separate matches. You haven't specified what language/regex-engine you're using, but presumably it provides some mechanism to get multiple matches. – Oliver Charlesworth Sep 05 '16 at 12:36
  • 1
    I'm voting to close this question as off-topic because it is a question about regex utility API and it doesn't specify the tool/language – Denys Séguret Sep 05 '16 at 12:37
  • See https://regex101.com/r/eM6jI2/1 – Wiktor Stribiżew Sep 05 '16 at 12:37
  • 1
    Possible duplicate of [Oracle 11g get all matched occurences by a regular expression](http://stackoverflow.com/questions/17596363/oracle-11g-get-all-matched-occurences-by-a-regular-expression) – tripleee Sep 05 '16 at 15:46

1 Answers1

1

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.

redneb
  • 21,794
  • 6
  • 42
  • 54
  • Thank you so much! I'm using Oracle SQL, so in this case it's just the /g flag. My final result is /([^0-9.])/g and it is working correctly. Accepting your answer. – Zargontapel Sep 05 '16 at 12:37