w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Textarea is taking lot of time to validate text when pasted from notepad using RegExp in javascript

This is probably because the regexp goes into a loop. Try to find a simpler regexp that terminates faster in case of an error.

Look into *? or validate the text in pieces by first matching part of the regexp (the header). If there is no header -> error.

Then strip the header. Search the rest of the input for the inverse of the allowed characters ([^...allowed chars...]. If you have a match anywhere -> error





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.