I know JavaScript regular expressions can ignore case for the entire match, but what about just the first character? Then hello World! would match Hello World! but not hello world!.
+3
A:
You mean like /[Tt]uesday/
The [Tt] creates a set, which means either 'T' or 't' can match that first character.
Eli
2010-04-25 04:49:28
This question had zero answers when I clicked on it. Now two. I fail to snipe easy points yet again :(
erisco
2010-04-25 04:51:37
That's a direct contradiction of the requirements as stated in your question.
Tim Pietzcker
2010-04-25 05:36:28
+2
A:
Your question doesn't really make sense. Since the edit, it now says "I am after a general regular expression that can be applied to all words.". The regex to match all words and punctuation would be ".*"
What are you trying to match? Can you give examples of what should match and what should not match?
Zarigani
2010-04-25 05:24:36
+2
A:
Do it another way. Force the first character of your data string to lower case before matching it against your regular expression. Here's how you'd do it in ActionScript, JavaScript should be similar:
var input="Hello World!";
var regex=/hello World!/;
var input2 = input.substr(0, 1).toLowerCase() + input.substr(1);
trace(input2.match(regex));
davr
2010-04-25 06:19:40