Regular expression to identity special character

Hello friends i need a regular expression which will check if the string
contain the special character or not? and accordingly it should return
true,
false value.

Thanks
abhi

Hey Fred,
Suppose i have a string “abcde fghi” it should gives true, and suppose
if i
have a string “abcd %$# fghi” it should return false.

Thanks

On Sat, Sep 27, 2008 at 5:13 PM, Frederick C. <

On Sep 27, 12:36 pm, “Abhishek shukla” [email protected] wrote:

Hello friends i need a regular expression which will check if the string
contain the special character or not? and accordingly it should return true,
false value.

Depends entirely on what you mean by special character?

Fred

That’s still not very precise. Do you mean anything that’s not a
letter or a space? What about punctuation, numbers etc… ? You’re
probably just going to end up with one of the builtin character
classes like \w or custom ones like [a-z]

Sent from my iPhone

On 27 Sep 2008, at 12:47, “Abhishek shukla” [email protected]

yes basically i don’t want my string should contain any ‘punctuation’ if
so
then it should return false.
regards
abhishek

On Sat, Sep 27, 2008 at 6:11 PM, Frederick C. <

Hi Abhishek,

Take a look on this article:

http://marcricblog.blogspot.com/2008/08/bitwising-ruby.html

More specifically, the last example.

On that case I just consider words. You will need to adapt it to your
needs.

Regards.

You can use http://www.rubular.com/ to test and find the regex you
need.