Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Search <a*1>*2</a> and replace to *2 in QTextEdit
QtWS25 Last Chance

Search <a*1>*2</a> and replace to *2 in QTextEdit

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 178 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by
    #1

    Remove link element, leave link.innerHTML.
    For example:

    <a href="http://image109.360doc.com/DownloadImg/2018/01/2720/123210122_5_20180127084053409.jpg" target="_blank" data-lightbox-group="group1517056981927"><img src="http://image109.360doc.com/DownloadImg/2018/01/2720/123210122_5_20180127084053409.jpg"></a>
    

    Chance to:

    <img src="http://image109.360doc.com/DownloadImg/2018/01/2720/123210122_5_20180127084053409.jpg">
    

    https://github.com/sonichy

    ODБOïO sonichyS 2 Replies Last reply
    0
    • sonichyS sonichy

      Remove link element, leave link.innerHTML.
      For example:

      <a href="http://image109.360doc.com/DownloadImg/2018/01/2720/123210122_5_20180127084053409.jpg" target="_blank" data-lightbox-group="group1517056981927"><img src="http://image109.360doc.com/DownloadImg/2018/01/2720/123210122_5_20180127084053409.jpg"></a>
      

      Chance to:

      <img src="http://image109.360doc.com/DownloadImg/2018/01/2720/123210122_5_20180127084053409.jpg">
      
      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      @sonichy hi
      https://regex101.com/r/EE08dw/1

      JonBJ 1 Reply Last reply
      2
      • ODБOïO ODБOï

        @sonichy hi
        https://regex101.com/r/EE08dw/1

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @LeLev
        Assuming that works, good one, better you than me! These reg exs are getting ridiculously complex these days....

        1 Reply Last reply
        0
        • sonichyS sonichy

          Remove link element, leave link.innerHTML.
          For example:

          <a href="http://image109.360doc.com/DownloadImg/2018/01/2720/123210122_5_20180127084053409.jpg" target="_blank" data-lightbox-group="group1517056981927"><img src="http://image109.360doc.com/DownloadImg/2018/01/2720/123210122_5_20180127084053409.jpg"></a>
          

          Chance to:

          <img src="http://image109.360doc.com/DownloadImg/2018/01/2720/123210122_5_20180127084053409.jpg">
          
          sonichyS Offline
          sonichyS Offline
          sonichy
          wrote on last edited by
          #4

          @sonichy

          s.replace(QRegularExpression("<a(.*?)>(.*)</a>"), "\\2");
          

          https://github.com/sonichy

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved