简体   繁体   中英

Replace with regular expression in notepad++

I have a dropdown list which displayed in page source:

<option value="2" >39</option>
<option value="3" >40</option>
<option value="4" >40.5</option>
<option value="5" >41.5</option>
<option value="6" >42</option>

After searching I find the solution to replace the option tags:

Find: <option[^>]*>([^<]*)</option>

replace with \\1, which result in:

39
40
40.5
41.5
42

But I also want to remove all the white spaces and new lines, and replace "." with "_", so the output should be 39,40,40_5,41_5,42 Thanks.

I can't see a way to do the job with an unique regex, but in two passes:

First pass:
Find what: <option[^>]*>([^<]*)</option>\\R
Replace with: $1,

Second pass:
Find what: \\.
Replace with: _

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM