function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bca321bca321 

How to use "RegExp"

Hi,

 

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.

 

Jeremy-KraybillJeremy-Kraybill

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

 

Jeremy Kraybill

Austin, TX

bca321bca321

hi,

 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