Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check if a string starts with number using regular expression

Tags:

People also ask

How check string starts with in RegEx?

To check the beginning of a string using a regular expression in JavaScript, use the test() function and a regular expression that starts with ^ . The ^ character is a special character that represents the start of the string. The test() function will search the string and return true if the string contains a match.


I am writing a filebeat configuration when I am matching if a line starts with a number like 03:32:33 ( a timestamp). I am currently doing it by-

\d

But its not getting recognised, is there anything else which I should do. I am not particularly good/ have experience with regex. Help will be appreciated.