Skip to main content
added 6 characters in body
Source Link
cropredy
  • 73.3k
  • 8
  • 128
  • 284

A typical reason for regex too complicated is when the target string is > 1 MB

The String class has three methods:

  • someString.replace(target,replacement)someString.replace(target,replacement)
  • someString.replaceAll(regex,replacement)someString.replaceAll(regex,replacement)
  • someString.replaceFirst(regex,replacement)someString.replaceFirst(regex,replacement)

Your application is trying to replace data:image/png;base64, with simply ,

If your application is OK with replacing all of data:image/png;base64, with ,, then use the replace(target,replacement) method as it doesn't use regex

Example:

someString.replace('data:image/png;base64,',',');

A typical reason for regex too complicated is when the target string is > 1 MB

The String class has three methods:

  • someString.replace(target,replacement)
  • someString.replaceAll(regex,replacement)
  • someString.replaceFirst(regex,replacement)

Your application is trying to replace data:image/png;base64, with simply ,

If your application is OK with replacing all of data:image/png;base64, with ,, then use the replace(target,replacement) method as it doesn't use regex

Example:

someString.replace('data:image/png;base64,',',');

A typical reason for regex too complicated is when the target string is > 1 MB

The String class has three methods:

  • someString.replace(target,replacement)
  • someString.replaceAll(regex,replacement)
  • someString.replaceFirst(regex,replacement)

Your application is trying to replace data:image/png;base64, with simply ,

If your application is OK with replacing all of data:image/png;base64, with ,, then use the replace(target,replacement) method as it doesn't use regex

Example:

someString.replace('data:image/png;base64,',',');
Source Link
cropredy
  • 73.3k
  • 8
  • 128
  • 284

A typical reason for regex too complicated is when the target string is > 1 MB

The String class has three methods:

  • someString.replace(target,replacement)
  • someString.replaceAll(regex,replacement)
  • someString.replaceFirst(regex,replacement)

Your application is trying to replace data:image/png;base64, with simply ,

If your application is OK with replacing all of data:image/png;base64, with ,, then use the replace(target,replacement) method as it doesn't use regex

Example:

someString.replace('data:image/png;base64,',',');