Regular expressions « Core Library « Java Articles

Java Articles
1. Build Deploy
2. Class
3. Core Library
4. Data Types
5. Database JDBC
6. Design
7. Development
8. File Input Output
9. Graphics Desktop
10. J2EE Enterprise
11. J2ME Wireless
12. JVM
13. Language
14. Library Product
15. Network
16. Security
17. SOA Web Services
18. Test
19. Web Development
20. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Products
Java by API
Photoshop Tutorial
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Articles » Core Library » Regular expressions 
1. Regular expressions simplify pattern-matching code
"Listing 1 includes System.out.println ("Found " + m.group ());. Notice the call to group(). That method is one of three capturing group-oriented Matcher methods:"

2. Matchmaking with regular expressions
"Many languages, including Perl, PHP, Python, JavaScript, and JScript, now support regular expressions for text processing, and some text editors use regular expressions for powerful search-and-replace functionality. What about Java? At the time of this writing, a Java Specification Request that includes a regular expression library for text processing has been approved; you can expect to see it in a future version of the JDK."

3. Regular Expressions in J2SE
"JDK 1.4 supports regular expressions in the java.util.regex package. Use of this package and supporting classes makes string search and manipulation very easy. It helps reduce the development effort, and at the same time significantly improves the maintenance of code. Since classes in this package are a standard part of core Java, they don't have to be distributed separately, and can be assumed to be present. We will see at the end of article how regular expressions simplify the implementation of email validation."

4. Regular Expressions and the Java Programming Language
"Applications frequently require text processing for features like word searches, email validation, or XML document integrity. This often involves pattern matching. Languages like Perl, sed, or awk improves pattern matching with the use of regular expressions, strings of characters that define patterns used to search for matching text. To pattern match using the Java programming language required the use of the StringTokenizer class with many charAt substring methods to read through the characters or tokens to process the text. This often lead to complex or messy code."

5. Magic with Merlin: Parse sequences of characters with the new regex library
"In the context of regular expressions, patterns are text representations of sequences of characters. For instance, if you wanted to know if the word car existed within a character sequence, you would use the pattern car because that is how you represent the exact string. For a more complicated pattern, you can use special characters as placeholders. If instead of searching for car, you wanted to search for any string of text that began with the letter c and ended with the letter r, you would use the c*r pattern, where * represents any number of characters before the first r. The c*r pattern would match any string of characters that begins with c and ends with r, as in cougar, cavalier, or chrysler."

6. Using regular expressions
"This free tutorial explains how to use regular expressions to search for and modify patterns in text. The tutorial starts with the basics, and then progresses to intermediate and advanced topics, with lots of examples along the way."

7. Validate localized data with regular expressions
"This article has shown you how to combine regular expressions and the Java language's internationalization support to validate different kinds of localized data. With this technique, you can support new data types without changing your code at all. Thinking back to the sample application, for example, if you want to add support for Polish postal codes, simply create a messages_pl. properties file. That adds support for a new data type without changing a line of code. (The regular expression for Polish postal codes is [0-9]{2}-?[0-9]{3}, in case you're wondering.)"

8. Regular Expressions in Java
"Until recently, Java programmers had to turn to third-party libraries such as IBM's regex for Java. The newest JDK, JDK 1.4, makes regular expressions into first-class citizens."

w_w___w_._j__a_v_a2_s___.com_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.