regex: force entire string to match

Trass3r un at known.com
Tue Jan 31 09:04:52 PST 2012


> I want to write a regex to check if a whole string is a number.
> With my current regex("[0-9]+") numbers will be carved out of things like
> "aaa456" (hit: 456) and I circumvent this by checking the lengths for
> inequality, which is stupid. My regex is surely missing something?

Try ^ and $ if applicable. These match start and end of a line.


More information about the Digitalmars-d-learn mailing list