+ 1
How to validate Regex
I mean to say: for example i have a string ("this is my String") and now i want to do this find the word from the string which contains a capital letter So how can i do it
2 Answers
+ 2
Use String.match(regex);
To search for a word, use: /\w+/g
And, for a word starting with a capital letter, use: /[A-Z]\w+/g
So, your required regex would be: "this is my String".match(/[A-Z]\w+/g);
+ 1
Thanks Rahul