File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes What is meant by [^a-zA-Z] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is meant by [^a-zA-Z]" Watch "What is meant by [^a-zA-Z]" New topic

What is meant by [^a-zA-Z]

Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Hi... friends

I come with the [^a-zA-Z] pattern especially in searching.
Can i know what is that and how JVM compiler deals with it.
David Newton

Joined: Sep 29, 2008
Posts: 12617

Have you checked out any Java regex tutorials/documentation? There's quite a lot available on the web, and it would answer your question very quickly.
Henry Wong

Joined: Sep 28, 2004
Posts: 20535

If you look again, you will see the syntax is not a java syntax, but part of a string that is passed to the regex engine.

I recommend starting with a tutorial on regular expressions....


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Rajeev Trikha
Ranch Hand

Joined: Jan 29, 2010
Posts: 85
It is worth spending time on learning about regular expressions as they would become indispensable part of your toolset. The shorthand you have shown just means 'not an alphabetic character' but dig deep it is worthwhile.

Rajeev Trikha (SCJP 6)
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46409
Agree with Henry about tutorials; here is another good one, in the Java™ Tutorials
I agree. Here's the link:
subject: What is meant by [^a-zA-Z]
It's not a secret anymore!