• Kunal Parmar 9
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
I am trying to parse a file uploaded in my org. I am using String.split('\\n'); to split the string so that it gives me a list of strings each individual element having one line of my parsed file. The code works fine with small files. But, my application needs to work with large files, mostly 5000+ lines. I get a "Regex too complicated" error when using my application with large files. Can someone suggest a work-around for this error. Thanks!

The code is as below,
Blob b = document.body;
    String content = b.toString();
    parts = content.split('\\n', -2);
    System.debug(parts);


where document is my uploaded file. 
I am trying to parse a file uploaded in my org. I am using String.split('\\n'); to split the string so that it gives me a list of strings each individual element having one line of my parsed file. The code works fine with small files. But, my application needs to work with large files, mostly 5000+ lines. I get a "Regex too complicated" error when using my application with large files. Can someone suggest a work-around for this error. Thanks!

The code is as below,
Blob b = document.body;
String content = b.toString();
parts = content.split('\\n', -2);
System.debug(parts);

where document is my uploaded file. 
I am trying to parse a file uploaded in my org. I am using String.split('\\n'); to split the string so that it gives me a list of strings each individual element having one line of my parsed file. The code works fine with small files. But, my application needs to work with large files, mostly 5000+ lines. I get a "Regex too complicated" error when using my application with large files. Can someone suggest a work-around for this error. Thanks!

The code is as below,
Blob b = document.body;
    String content = b.toString();
    parts = content.split('\\n', -2);
    System.debug(parts);


where document is my uploaded file. 
I am using the Pattern and Matcher classes to search text from an email.  Sometimes, I get an exception that says Regex too complicated.  I can't find any information on this.  Does anyone know what can cause?  I get the premise of the exception but don't know what to do to fix it.  If I put my regular expression and sample text into the tester on this site, http://www.fileformat.info/tool/regex.htm.  It works fine and returns what I want.  From what I understand Salesforce uses similar functionality as Java which the above site is using.  Any ideas?  Thanks.