Ronaldinho Learn Coding
Ronaldinho Learn Coding

Reputation: 13824

Notepad ++ How to remove all characters standing before a specific character

I searched all around but couldn't find any solutions.

I have:

<option value="1">Advertising
<option value="11">Aerospace
<option value="12">Agriculture
<option value="13">Architecture/Urban Planning
<option value="14">Arts
<option value="15">Automotive
<option value="16">Banking
<option value="17">Biotech & Pharmaceuticals
<option value="18">Business Services
<option value="19">Chemicals

I want delete all of text before the "> so the unnecessary text like <option value="1"> will be gone, only the Job type name such as Advertising being kept. How can I do it?

Upvotes: 12

Views: 56614

Answers (4)

Natzu
Natzu

Reputation: 1

Regular Expression .*">

Replace with empty

Upvotes: 0

Mr. C
Mr. C

Reputation: 1710

Alternatively, you could simply put the cursor between the > and C charters, then use Alt + Shift + Up Arrow to select multiple lines. Then hit the backspace key.

Cursor goes here--v--------
<option value="19">Chemicals  

This assumes all the lines line up. Dead useful for manipulating these types of files. Works usually in other programs too (Visual Studio, SSMS, etc).

Upvotes: 6

Ted Hopp
Ted Hopp

Reputation: 234857

Use a regular expression search.

  • Type ctrl-H to open the search-and-replace dialog.
  • Make sure that "Regular expression" is checked.
  • Put this in the "Find what" box: ^[^>]*>
  • Make sure that "Replace with" box is empty
  • Click on "Replace All"

Done!

Explanation: The regular expression can be broken down as follows:

  • ^ — match the start of a line
  • [^>] — match any character that is not the > character
  • * — repeat the previous as many times as possible
  • > — match a > character

Upvotes: 21

Desu
Desu

Reputation: 354

Use regular expressions like this one:<[^<]+?> and replace with empty string

Upvotes: 5

Related Questions