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?
我想在“>”之前删除所有的文本,这样就不会有像
3 个解决方案
#1
19
Use a regular expression search.
使用正则表达式搜索。
- Type ctrl-H to open the search-and-replace dialog.
- 键入ctrl-H打开搜索-替换对话框。
- 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 - > -匹配>字符
#2
5
Use regular expressions like this one:<[^<]+?>
and replace with empty string
使用正则表达式,比如:<[^ <)+ ?用空字符串替换>
#3
5
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.
或者,您可以将光标放在>和C charters之间,然后使用Alt + Shift + Up箭头选择多行。然后按回车键。
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).
这假设所有的线都对齐了。对于操作这些类型的文件非常有用。通常也在其他程序中工作(Visual Studio, SSMS等)。
#1
19
Use a regular expression search.
使用正则表达式搜索。
- Type ctrl-H to open the search-and-replace dialog.
- 键入ctrl-H打开搜索-替换对话框。
- 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 - > -匹配>字符
#2
5
Use regular expressions like this one:<[^<]+?>
and replace with empty string
使用正则表达式,比如:<[^ <)+ ?用空字符串替换>
#3
5
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.
或者,您可以将光标放在>和C charters之间,然后使用Alt + Shift + Up箭头选择多行。然后按回车键。
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).
这假设所有的线都对齐了。对于操作这些类型的文件非常有用。通常也在其他程序中工作(Visual Studio, SSMS等)。