aspose file tools*
The moose likes Java in General and the fly likes Regular Expressions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Regular Expressions" Watch "Regular Expressions" New topic
Author

Regular Expressions

Gustavo Adolpho Bonesso
Ranch Hand

Joined: May 11, 2002
Posts: 103
Hi !

Somebody knows good sites about Regular Expressions ?

Thank�s !


Gustavo Adolpho Bonesso<br />SCJP1.4
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Reference Website
Java Regular Expression From Sun

Regular Expression in Java


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
In addition, you may consider Max's RE book:
Java Regular Expressions: Taming the java.util.regex Engine.

Max is one of the moderators, and he also wrote a very good book for SCJD with J2SE 1.4.

Nick


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Jose D. Montero
Greenhorn

Joined: Apr 08, 2003
Posts: 1
I have preppared the following list of Web Refeences. For other information and examples, you may contact me at JoseDMontero@Yahoo.com

Regular Expressions � References
List prepared by Jose D. Montero (joseDMontero@yahoo.com)

Web References

Tutorial
� RegexBuddy's RegEx Tutorial
http://www.regular-expressions.info/tutorial.html
� An excellent tutorial and overview of regular expressions is Mastering Regular Expressions, 2nd Edition, Jeffrey E. F. Friedl, O'Reilly and Associates, 2002. Chapter 8: Java is available from O'Reilly.
RegEx in .Net
� RegEx in .Net
http://www.regular-expressions.info/dotnet.html
� The Regulator
The Regulator is an advanced, free regular expressions testing and learning tool. (C#, Visual Basic)
http://royo.is-a-geek.com/iserializable/regulator/
http://regulator.sourceforge.net/

RegEx in Java
� General information
http://www.regular-expressions.info/java.html
� Tutorial on regular expressions on Java 1.4
http://java.sun.com/docs/books/tutorial/extra/regex/index.html
� Sun Java Docs on RegEx
http://java.sun.com/j2se/1.4/docs/api/java/util/regex/package-summary.html

RegEx in JavaScript
http://developer.netscape.com/docs/manuals/js/core/jsref/regexp.htm
http://devedge.netscape.com/central/javascript/
http://www.regular-expressions.info/javascript.html

RegEx and XML

� Regular Expressions and XML
http://www.xfront.org/xml-schema/

� Tutorial on XML and RegEx
http://www.w3.org/TR/xmlschema-0/ - regexAppendix
Part of XML Schema Part 0: Primer

� XRE
http://www.utilities.cornell.edu/XML/XRE.html

Books
� �Mastering Regular Expressions� by Jeffrey E. F. Friedl,
Mastering Regular Expressions, 2nd Edition, Jeffrey E. F. Friedl, O'Reilly and Associates, 2002. Chapter 8: Java is available from O'Reilly.

RegEx Library
� RegEx Lib
http://www.regexplib.com/
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Jose, thanks for the comprehensive list! I archived it at http://faq.javaranch.com/view?ResourcesOnRegularExpressions - don't hesitate to correct or add things...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Tong Chen
Ranch Hand

Joined: Apr 26, 2002
Posts: 1011
And here is another good one:
http://www.regexlib.com/


Tong Chen (Seattle USA)<br />SCJP,SCWCD,SCDJWS,IBM XML,MCP.NET,MCAD.NET,MCSD.NET
Alan Moore
Ranch Hand

Joined: May 06, 2004
Posts: 262
The tutorial and reference at http://www.regular-expressions.info/ (mentioned above) is by far the best online resource I've seen. You want to be careful, though, because the tutorial is language-neutral, and not all of the features mentioned in it are available in all languages. So you'll get all excited about conditionals, for instance, only to learn that Java doesn't have them. But that's what the language-specific reference sections are there for.
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Gustavo Adolpho Bonesso:
Hi !

Somebody knows good sites about Regular Expressions ?

Thank�s !


Just curious... Why are you going to learn about RE? For Computer Science courses like Theory Of Computation or Complier Construction? Or do you just want to apply it in your work?

As for me, I learned it in the past, mainly because of my master course named "Principles of Theory of Computation and Languages"...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
RE is quite useful for searching in text documents, like Text Mining and Web Mining. I have worked with a small project in this area before.

Nick
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Nicholas Cheung:
RE is quite useful for searching in text documents, like Text Mining and Web Mining. I have worked with a small project in this area before.

Nick


Yes, me too,

And more
Use for check pattern of each data.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

Does Tiger add new features to RE?


Groovy
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Seems to me that Java RE aims to take the advantages of pattern matching in PERL, to make pattern comparsion and discovery be more easier.

Nick
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Use RE in Tiger ::

1. Scanner
The java.util.Scanner class can be used to convert text into primitives or Strings. Since it is based on the java.util.regex package, it also offers a way to conduct regular expression based searches on streams, file data, strings, or implementors of the Readable interface.

Reference Website
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html
Alan Moore
Ranch Hand

Joined: May 06, 2004
Posts: 262
Originally posted by Pradeep Bhat:
Does Tiger add new features to RE?


Yes, the Matcher class now has several new methods that make it easier to use for scanning or lexing applications (most of them, of course, are used in the Scanner class, mentioned above).
  • usePattern(Pattern) lets you use a different pattern for subsequent searches, without resetting the matcher's state.
  • region(int, int) lets you limit searches to a sub-range of the matcher's input. This has two related methods:
  • useAnchoringBounds(boolean) - if passed true, the start and end anchors (^ and $) will always match at the region's bounds.
  • useTransparentBounds(boolean) - if passed true, lookarounds and word-boundaries will be able to look past the region's bounds to determine whether they should match.
  • hitEnd() and requireEnd() are useful for working with streams; they let you know if reading in more data would change the result of the last match attempt.

  • There's also the static quote(String) method in Pattern that escapes all regex metacharacters in the string, allowing it to be matched as literal text. Matcher has a similar method, quoteReplacement(String), that escapes the '\' and '$' characters, for when the replacement string comes from an external source.

    All in all, this release raises the regex package to whole new level of usefulness.
    [ August 25, 2004: Message edited by: Alan Moore ]
    Ko Ko Naing
    Ranch Hand

    Joined: Jun 08, 2002
    Posts: 3178
    Originally posted by Nicholas Cheung:
    RE is quite useful for searching in text documents, like Text Mining and Web Mining. I have worked with a small project in this area before.

    Nick


    I also have to apply this knowledge in my master course "Advance Algorithms" in this semester... If I am not wrong, I will have to learn it in the next two weeks.... The topic is titled as String Matching...

    Algorithms-related subjects are tough for those, who are in CS, at least for me....
    Nicholas Cheung
    Ranch Hand

    Joined: Nov 07, 2003
    Posts: 4982
    String matching seems appeared in CS field for a long time.

    When I was studying the course Bioinformatics, the lecturer taught us using String matching algorithm to test the similarity of 2 DNAs.

    Although it was quite interesting, to me, it was the beginner of the nightmare!!!

    Nick
    Ko Ko Naing
    Ranch Hand

    Joined: Jun 08, 2002
    Posts: 3178
    Originally posted by Nicholas Cheung:
    When I was studying the course Bioinformatics, the lecturer taught us using String matching algorithm to test the similarity of 2 DNAs.

    Although it was quite interesting, to me, it was the beginner of the nightmare!!!


    The course seems interesting to me as well... Is that course similar to the course like Neural Networks, Genetic Algorithm and stuff like that?

    I also have to do a term project related to genetic algorithm in that "Advance Algorithm" course... The deadline is in September...
    Nicholas Cheung
    Ranch Hand

    Joined: Nov 07, 2003
    Posts: 4982
    It was not interesting anyway.

    It focus on scoring scheme that used to define the *similarity* of 2 strings (DNAs), and try to find out the optimal score.

    It was the toughest course I have ever taken.

    Nick
    Ko Ko Naing
    Ranch Hand

    Joined: Jun 08, 2002
    Posts: 3178
    Originally posted by Nicholas Cheung:
    It was the toughest course I have ever taken.


    But u made it with flying colours, didn't u?

    I'm trying so hard to pass the master course "Advance Algorithm" with flying colours as well... I'm not sure if I can do that...
    Gustavo Adolpho Bonesso
    Ranch Hand

    Joined: May 11, 2002
    Posts: 103
    Ko Ko Naing,

    I�m using RE to recognize filenames that fit in specific pattern in large directories. My application must decode these specific files...
    Ko Ko Naing
    Ranch Hand

    Joined: Jun 08, 2002
    Posts: 3178
    Originally posted by Gustavo Adolpho Bonesso:
    Ko Ko Naing,

    I�m using RE to recognize filenames that fit in specific pattern in large directories. My application must decode these specific files...


    If your filenames are simple to match and the patterns are stabe, you might not even need to use regex... String's normal methods such as startsWith(), endsWith(), indexOf(), lastIndexOf() and so on might be enough for your case... but I am not quite sure about the requirement of your application much...

    So for core regex, you might want to have a look at the links provided by somkiat above..
    Nicholas Cheung
    Ranch Hand

    Joined: Nov 07, 2003
    Posts: 4982

    I'm trying so hard to pass the master course "Advance Algorithm" with flying colours as well... I'm not sure if I can do that...

    I passed it with flying dark.

    Nick
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Regular Expressions
     
    Similar Threads
    how can i check valid characters in java script
    SWIFT Message Format Check Using Java
    validate text-only text field
    validating forms
    Telephone format validation rule in java