+ Start a Discussion

How to use "RegExp"



I want to know How to add the "regExp" for Apex code. I have list of data as a .txt file. I want to split that data put a array.


Help me.



Look at the documentation for String. String.split() takes a regex.


Jeremy Kraybill

Austin, TX



 Thanks. I serch that one. But I havent Idea.

Pl's give me an example. I want split my data using regExp. ex ;"simon josap josap simaon 233467". like that data set i want split using regExp. pl's give a sampal code.


 private static String TestOne() {
      String regex = " \\n";
    String input = "Full Name    First Name    Last Name  Phone Number";
    Pattern p = Pattern.compile(regex);
    Matcher m = p.matcher(input);
    String[]items = p.split(regex);
    return items[0];



This code is not working. Help me.

Message Edited by bca321 on 02-19-2009 10:36 AM