lucy24 - 1:24 pm on Aug 23, 2013 (gmt 0)
Non-hyphens are best expressed as a negative like
You don't have to find all of them; even if there's only one, the condition fails. (Or succeeds, depending on how you look at it.)
In fact all of the hyphen-related rules work best as negatives. As a single rule:
or, probably more efficiently,
where a leading ! applies to the whole pattern.
If you say [^-] then you open the door for non-word characters such as punctuation.
I don't think you've ever explained what this RegEx-- we're now in the php forum-- is actually supposed to do. In the other thread, you're constructing a RewriteRule based on identifying a pattern in an incoming request. What's happening here? All of the Regular Expressions we've talked about will only work if you're testing against an existing string. If you're constructing the string in the first place, you need a different set of rules.