I have a code of line as:
Pattern pattern = Pattern.compile("^\\d{1,4}\\,(.*?),");
I want to understand what exactly is getting done in above regular expression,i.e.
"^\\d{1,4}\\,(.*?),"
I have a code of line as:
Pattern pattern = Pattern.compile("^\\d{1,4}\\,(.*?),");
I want to understand what exactly is getting done in above regular expression,i.e.
"^\\d{1,4}\\,(.*?),"
^\d{1,4},(.*?),
Explaination:
^\d{1,4} -- means must begin with between 1 to 4 digits (characters between 0 and 9)...\, -- means then there have ,(.*?) -- means there will be any character 0 or more times but will happen 0 or 1 time...,Look at this demo.. you will get better explaination here
Look at this answer to learn about regex.....
