AlexV
AlexV

Reputation: 23108

What does this regular expression do exactly?

The PHP code is:

$cleanedVer = preg_replace('/[^0-9,.,a-z,A-Z-]/','',$someVer);

It cleans the version sting but sometimes cleans too much info.

I'm not sure what this PCRE regular expression do to the the string in the above snippet. Anyone care to explain?

Upvotes: 0

Views: 85

Answers (1)

Evan Davis
Evan Davis

Reputation: 36592

It removes any character which is not an alphanumeric, dot (.), commas (,) or hyphen (-).

Upvotes: 6

Related Questions