doucha7329 2012-11-07 03:14
浏览 33

找到2点之间的字符串,并在另外2点之间移动

I have a lot of urls that are sadly static, to change them I need to use some type of application or script.. I have about 400 files with urls ranging from 15-150 on each.

Here is an example of what I'm trying to do:

Change:
<td class="SELECTX"><strong>Text example 1 <a href=""></a>Text Example 2 </strong></td>

To:
<td class="SELECTX"><strong> <a href=""></a>Text example 1 Text Example 2 </strong></td>

I would love a way to change this on all files at once, but if I can't then at least a way to where I can change all urls on 1 file without having to do manual cut and paste.

I searched and searched for over 3 hours and found nothing... I hope someone can help.

Edit: Basically I'm trying to find the text/string between <strong and <a href= which would be "Text example 1" then move it to go after ""></a> . Which would now come before "Text Example 2"

  • 写回答

3条回答 默认 最新

  • dongpu42006096 2012-11-07 03:29
    关注

    To find the string between the two (or ) tag's I'd probably just use a regular expression to find where in the file the strings are, then process each string/line in a script.

    Then maybe for each line, find the opening tag and the closing tag which would give me the indexes of the section of the string that needs swapping, and swap the 2 pieces along the index of the opening tag.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度