I want to create a pattern which will allow this: "What is [anything here]?"
Valid example: What is an orange?
This is the pattern I have so far but it doesn't seem to be working:
"/^what is *\?$/i"
Could you please tell me what I'm doing wrong? Cheers.
Simple Preg Match
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Simple Preg Match
The * means any number of the previous thing, it your case it is a space character. The . will match any character, so maybe use "/^what is .*\?$/i"
(#10850)