Perl – If string contains text?

If you just need to search for one string within another, use the index function (or rindex if you want to start scanning from the end of the string): if (index($string, $substring) != -1) { print “‘$string’ contains ‘$substring’\n”; } To search a string for a pattern match, use the match operator m//: if ($string … Read more

How to check if matching text is found in a string in Lua?

There are 2 options to find matching text; string.match or string.find. Both of these perform a regex search on the string to find matches. string.find() string.find(subject string, pattern string, optional start position, optional plain flag) Returns the startIndex & endIndex of the substring found. The plain flag allows for the pattern to be ignored and … Read more

javascript regular expression to check for IP addresses

May be late but, someone could try: Example of VALID IP address 115.42.150.37 192.168.0.1 110.234.52.124 Example of INVALID IP address 210.110 – must have 4 octets 255 – must have 4 octets y.y.y.y – only digits are allowed 255.0.0.y – only digits are allowed 666.10.10.20 – octet number must be between [0-255] 4444.11.11.11 – octet … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)