Posts

Showing posts with the label Regex Expression with .test(). test function in Javascript

Regex with .test() In JavaScript

Image
 REGEX is very interesting and helping  RegEx  It is an Acronym means Regular Expression The Work of Regex  Regular Expressions  (Regex) Regular Expression, or regex or regexp inshort, it is tremendously powerful in searching and manipulating text sub-strings of any String, particularly in processing text files. One line of regex can easily replace multiple lines of programming codes Regex work as to search and return true if the search regex gets found  like in any string we have to search any particular words if that word of clause exist in that given string or other datatypes then it the .test() function will return True This is the Alternative Code for Regex Expression and .test() var str1 = "Hello My Name Is Shivam Dixit" ; var result = false ; var search = "Shivam" ; function regextest ( str1 , result , search ){ for ( var i = 0 ; i < str1 . length ; i ++ ){ if ( str1 [ i ] === search [ 0 ]){ for ( var j = 1 ; j < search . length ; j ++ ){ if (

Pageviews