Is the regex too complicated problem a regex problem?

Is the regex too complicated problem a regex problem?

So we don’t believe it is actually a regex problem, because the regular expression is just finding commas to split up a comma separated file/string – i.e. it’s very simple.

How to avoid’regex too complicated’error in apex?

As noted, you are on your own regarding memory and CPU usage. It actually required some golfing to find a numRepeats value which triggers “Regex too complicated” while avoiding “String is too long.”, “Apex heap size too large…”, and “Apex CPU time limit exceeded”.

How to reduce file size with regex too complicated?

This applies whether we reduce the number of rows, or reduce the width of certain columns of data by truncating them to 3000 characters (a small number of columns have 10,000 characters of text included). When we do either or both of these steps in any combination to reduce the file size, we don’t get this problem.

When to truncate columns in regex too complicated?

The same data works in smaller volumes, but not beyond a certain threshold. This applies whether we reduce the number of rows, or reduce the width of certain columns of data by truncating them to 3000 characters (a small number of columns have 10,000 characters of text included).

How to split a string to equal length in Java?

In case you want to split the string equally backwards, i.e. from right to left, for example, to split 1010001111 to [10, 1000, 1111], here’s the code: Java 8 solution (like this but a bit simpler):

Is there a limit on the number of regex matches?

As others have mentioned, there is a limit on the number times a regex can match an input sequence (as of this writing). If you are using Pattern and Matcher objects, you can periodically reset this limit by resetting the Matcher. This makes sense, since the documentation (now) says that the access count limit is tied to the input sequence.