Update platforms.txt, boards.txt to use regex based subsitution #57

Open
ricklon opened this Issue Jul 3, 2011 · 0 comments

Projects

None yet

1 participant

@ricklon
Member
ricklon commented Jul 3, 2011

Update platforms.txt, boards.txt to use regex based subsitution

This would replace the {0}, {1} message subsitution with {key1}, {key2}

Test code:

/*
*
* Regular Expression Hello Replace groups
*
*/

import java.util.regex.*;

public class RegexProperties {


    public static void  main (String[] args) {
        System.out.println("HelloRegex: Start");

        //String patternStr = "\\(a\\).+\\(e\\)";
        String patternStr = "([a][b]).*([e])";
        String replaceStr = "<$2>";
        Pattern pattern = Pattern.compile(patternStr);


        CharSequence inputStr = "{prop1}cd e {prop2}";
        System.out.println("inputStr: " + inputStr );
        Matcher matcher = pattern.matcher(inputStr);
        String output = matcher.replaceAll(replaceStr);
        System.out.println("output: " + output);
    }
}
@ricklon ricklon was assigned Jul 3, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment