Match beginning/end of line

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Match beginning/end of line Fri Dec 29, 2023 7:32 pm • by jandamm
I want to match a date in the contents of a file and there should be no text behind the date in the line.

I've tried to get it to work but haven't found a way and also didn't find anything in the guide or forum.

Given this content of a file:
Code: Select all
hello 12.12.23 text
13.12.23
Another line
14.12.23

I want to match the 13th but cannot use 2nd match since this might differ.
The best detection is that the date is the only content in the line.

So using RegEx I'd match `^\d{2}.\d{2}.\d{2}$` but I cannot find the equivalents for ^ and $.
jandamm
 
Posts: 8
Joined: Sun Feb 18, 2018 10:46 am

Re: Match beginning/end of line Tue Jan 02, 2024 10:42 am • by Mr_Noodle
Is the text on the previous or following line consistent?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support