Delete everything after the 5 character in a every line
-
Hi
how to delete everything after the 5 character in a every line15230;reherherhkwef…com/; 164; 3
23018;reherherhkwefk…com/; 164; 3
26230;reherherhjwejf…com/; 164; 3
30240;reherherjwejfwh…com/; 164; 3
29305;reherherhjwekfkw…com/; 164; 3final result is
15230
23018
26230
30240
29305 -
@jacob-johnson
Thank you for presenting your input and desired output in text format.- Open the find/replace form and select the
Replace
tab (keyboard shortcutCtrl+H
gets here. - Run the following find-replace:
Find what:
(?-s)^(.{5}).*
Replace with:${1}
Search Mode:Regular expression
This does the following:
(?-s)
makes it so.
matches every character except newlines^
attempts to match only at the start of a line.(.{5})
matches the first five characters of the line, and stores them in the first capture group (we’ll come back to this later).*
matches the rest of the line but does not capture it.
Then the Replace with
${1}
takes the text that was matched and replaces it with the first capture group, meaning that each line is replaced with its first five characters.Lines with fewer than five characters will not be affected by this regex-replace, which I assume is what you want.
Further documentation on regular expressions can be found in this section of the user manual.
- Open the find/replace form and select the
-
@Mark-Olson thank you! :)