Reputation: 15
suppose i have this
sdasdas 300 qweqweqwe
I can match it with this regex (\d{2,4})
But how do I match it if one of digits is 'O' not 0 ?(for example 3O0)
Upvotes: 0
Views: 49
Reputation: 174874
Just put \d
, Uppercase O and lowercase o inside the character class.
[\doO]{2,4}
OR
Use i
modifier to turn off the case sensitive mode.
/[\do]{2,4}/i
Upvotes: 1
Reputation: 2564
If you want to match a number with 'o' or 'O'; this will work :
([oO\d]+)
Upvotes: 0
Reputation: 76676
Simple enough. Change the character class to include O
(both cases) as well:
([\doO]{2,4})
Upvotes: 2