Activity Forums Salesforce® Discussions How to read text between tags in Salesforce?

  • madhulika shah

    Member
    August 29, 2018 at 5:37 am

    Hi Chanchal,

    You have to use Java regex to extract text between tags. Code snippet for the following is:

    final Pattern pattern = Pattern.compile("<tag>(.+?)</tag>");
    final Matcher matcher = pattern.matcher("<tag>String I want to extract</tag>");
    matcher.find();
    System.out.println(matcher.group(1)); // Prints String I want to extract

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos