Is there any way to search for > followed by a space, but ONLY in column 1 of a file? I have tried various permutations following suggestions in the help file, so far without success.
Regards
Mach1
Search for > in column 1
Moderators: AmigoJack, bbadmin, helios, MudGuard
I am confused! 
I tried your suggestion, but it seemes to find any line starting with a blank. So I played around a bit and found that this works: ^>[>[:blank:]]
I am an absolute beginner on this topic and do not understand what the different elements of the expression signify - but I appear to need BOTH > symbols to get this working.
Can anyone offer a beginners source that gives a little explanation of the syntax?
Thanks.
I tried your suggestion, but it seemes to find any line starting with a blank. So I played around a bit and found that this works: ^>[>[:blank:]]
I am an absolute beginner on this topic and do not understand what the different elements of the expression signify - but I appear to need BOTH > symbols to get this working.
Can anyone offer a beginners source that gives a little explanation of the syntax?
Thanks.
This isn't correct. That matches either ">" or a space or a tab at the start of the line, not what Mach1 was asking for.ACRobin wrote:"^[>[:blank:]]"
The above (minus the quotes) is the regular expression you will need in the Find box (regular expression - ticked).
The correct expression is: ^>_
where _ represents a space.
Make sure "Regular expression" is ticked in the Find dialog.
Andrew
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
Your regular expression is incorrect.
^>[>[:blank:]] matches
Thus it matches on lines that begin with with a >, followed by either a another > or a blank. So it matches, for example, on lines that begin
>>xxxx
As Andrew suggested, you can use a simple space instead of the cumbersome expression [:blank:], unless the > might be followed by a tab instead of a space (in which case [ \t] is shorter).
There are many regular expression tutorials on the web, and you will find recommendations for some of them if you search this forum.
A standard reference for regular expressions is
Friedl, Jeffrey E F
Mastering Regular Expressions, 3rd ed
O'Reilly, 2006
ISBN: 0-596-52812-4
http://regex.info/
But be aware that the regular expression recogniser used by TextPad is very weak compared with modern tools. So you may get frustrated if you discover a handy trick that works elsewhere but doesn't work in TextPad.
^>[>[:blank:]] matches
Code: Select all
^ the beginning of a line
> the literal text: >
[>[:blank:]] either a > or a blank
>>xxxx
As Andrew suggested, you can use a simple space instead of the cumbersome expression [:blank:], unless the > might be followed by a tab instead of a space (in which case [ \t] is shorter).
There are many regular expression tutorials on the web, and you will find recommendations for some of them if you search this forum.
A standard reference for regular expressions is
Friedl, Jeffrey E F
Mastering Regular Expressions, 3rd ed
O'Reilly, 2006
ISBN: 0-596-52812-4
http://regex.info/
But be aware that the regular expression recogniser used by TextPad is very weak compared with modern tools. So you may get frustrated if you discover a handy trick that works elsewhere but doesn't work in TextPad.
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm