Asim Zaidi
Asim Zaidi

Reputation: 28284

What would this regex match?

Hi any idea what this is matching thanks

preg_match('/^[1-8](0|5)$/', $myValue)

Upvotes: 0

Views: 86

Answers (4)

salathe
salathe

Reputation: 51950

It matches an occurrence of 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, or 85 (with a trailing newline character \n if one is present).

Upvotes: 1

OdinX
OdinX

Reputation: 4211

This might be useful to you, enter the regular expression and view for yourself:

http://strfriend.com/

The site will depict what a given regular expression will match

Upvotes: 1

Joey
Joey

Reputation: 354566

  • Start of string
  • A digit between 1 and 8
  • Either a digit 0 or 5
  • End of string

Upvotes: 4

Matthew Flaschen
Matthew Flaschen

Reputation: 284836

Beginning of string, digit from 1-8, capturing group matching either 0 or 5, end of string.

Upvotes: 4

Related Questions