I'm trying to ensure that a string in PHP has only letters, hyphens or apostraphes. To accomplish this I wanted to make a range of valid characters using [ ]. So my idea was to do this:
[[A-Za-z]-'] // Weird syntax highlighting here
Will this work? Is it possible to nest brackets like that? This is meant to match a single character that is either a letter, a hyphen, or an apostraphe. I may be approaching the problem naively and that's OK, I just wanted to know if putting brackets within brackets like this is legal in PHP. Thanks!