Pages

Showing posts with label Regex. Show all posts
Showing posts with label Regex. Show all posts

Thursday, September 22, 2011

Linux -=- Good reference for Regular Expression with GREP

Hi!

I've found a good reference that helps to understand regular expression with GREP.


Yann

Tuesday, August 9, 2011

Java -=- Regex find example

Here's a simple example that shows how to find the value of different groups in a string with a regular expression.

Pattern pattern = Pattern.compile("^([a-zA-Z0-9]*)_(\\d*)?_?(.*)-\\d*_.*$");
Matcher m = pattern.matcher(resourceFile.getName());

if (m.find()) {
    String destinationNickname = m.group(1);
    String jobnumber = m.group(2);
    String originalFileName = m.group(3);
} 

Test your regex with this site: http://www.regexplanet.com/simple/index.html

Tuesday, July 19, 2011