Searching for between <STUFF> : Result goes beyond to include next argument
-
Notepad++ v8.7.5 (64-bit)
Build time : Dec 21 2024 - 05:13:03
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : ON
Placeholders : OFF
DirectWrite : ON
Multi-instance Mode : monoInst
File Status Auto-Detection : cdEnabledNew (for current file/tab only)
Dark Mode : OFF
OS Name : Windows 11 Pro (64-bit)
OS Version : 24H2
OS Build : 26100.2894
Current ANSI codepage : 1252
Plugins :
mimeTools (3.1)
NppConverter (4.6)
NppExport (0.4)
Fellow Notepad++ Users,Could you please help me the the following search-and-MARK problem I am having?
Here is the data I currently have (“before” data):
<td colspan="4" width="2000" height="304"><font size="2">I</font>n another life,
Here is how I would like that data to look (“after” data):
<td colspan="4" width="2000" height="304"> (I want just this highlighted)
To accomplish this, I have tried using the following Find/Replace expressions and settings
- Find What =
<td .*>
- Replace With = HIGHLIGHT/MARK
- Search Mode = REGULAR EXPRESSION or NORMAL (tried both of these)
- Dot Matches Newline = CHECKED or NOT CHECKED (I don’t see this option)
HERE IS WHY YOU THOUGHT YOUR EXPRESSION WOULD WORK
I understand why it is going beyond the first argument, I just don’t know how to limit it.
Thank you in advance!
- Find What =
-
-
.* is greedy
Try .*? which is non-greedyThat works perfectly. This also allowed me to go back to the instruction manual and find it. The “Multiplying Operators” threw me. I was looking for multiple characters after single characters!