#37 Find and replace help

None
closed
None
5
2014-07-01
2014-02-28
Anonymous
No

Hi - I've used FAR extensively in the past to clean up html files. However, none of the search and replace I'm using is working - I've even got the original, but no luck.
Some interface changes so not sure what I'm looking at any more, but it used to be very intuitive.

For example, just wanting to remove a string: <a name="_Toc375138174"></a>

so use Find:
<a name="_Toc375138174"></a>

and Replace:
<a name="_Toc*"></a>

I've tried using . and * - looking at your docs, I'm not quite clear - and turning on and off regular expressions.

Oddly, a few (or maybe only one) are replaced, but mostly not

I was able to remove empty paragraphs so not sure what I'm doing wrong with the a name, but the way I used it before doesn't seem to be working now.

Any help appreciated

Related

FARTzzz: #37

Discussion

  • Olivier Wehner

    Olivier Wehner - 2014-03-05
    • assigned_to: Olivier Wehner
    • Group: -->
     
  • Olivier Wehner

    Olivier Wehner - 2014-03-05

    To remove the numbers use Replace: <a name="_Toc"></a>
    To remove the entire expression don't put anything in the Replace box.
    . and * have no special meaning in the Replace part, they only work in the Find box.

    In the Find box . means "any character" and * means "any number of times what comes before the asterisk". Thus "_Toc*" would find _To, _Toc, _Tocc, _Toccc ans so on. "_Toc." would find _Toca, _TocB, _Toc2, _Toc! etc.

    Kind regards,
    Olivier

     
    Last edit: Olivier Wehner 2014-03-07
    • cay

      cay - 2014-03-05

      ok, thanks - I think I (kind of) figure it out, this sounds like what I
      thought but thanks for the clarity (esp re has no meaning in replace
      box, that makes sense).

      Formerly, I just used * to indicate any number of characters, any number
      of times - but for what comes after the asterisk. This sounds very
      different, and not sure what I need to do differently.

      I seem to have gotten most of it working, but not quite sure how, so any
      additional help appreciated. Specifically, I need to say "what comes
      after this string" rather than before, so could you clarify how I should
      do this?

      Thanks so much

      -------- Original Message --------

      To remove the numbers use Replace: http://sourceforge.net
      To remove the entire expression don't put anything in the Replace box.
      . and * have no special meaning in the Replace part, they only work in
      the Find box.

      In the Find box . means "any character" and * means "any number of
      times what comes before the asterisk". Thus "_Toc*" would find _To,
      _Toc, _Tocc, _Toccc ans so on. "_Toc." would find _Toca, _TocB, _Toc2,
      _Toc! etc.

      Kind regards,
      Olivier


      [fartzzz:#37] http://sourceforge.net/p/findandreplace/fartzzz/37/
      Find and replace help

      Status: open
      Group:
      Created: Fri Feb 28, 2014 09:18 PM UTC by Anonymous
      Last Updated: Fri Feb 28, 2014 09:18 PM UTC
      Owner: Olivier Wehner

      Hi - I've used FAR extensively in the past to clean up html files.
      However, none of the search and replace I'm using is working - I've
      even got the original, but no luck.
      Some interface changes so not sure what I'm looking at any more, but
      it used to be very intuitive.

      For example, just wanting to remove a string: http://sourceforge.net

      so use Find:
      http://sourceforge.net

      and Replace:
      http://sourceforge.net

      I've tried using . and * - looking at your docs, I'm not quite clear -
      and turning on and off regular expressions.

      Oddly, a few (or maybe only one) are replaced, but mostly not

      I was able to remove empty paragraphs so not sure what I'm doing wrong
      with the a name, but the way I used it before doesn't seem to be
      working now.

      Any help appreciated


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/findandreplace/fartzzz/37/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      FARTzzz: #37

  • Olivier Wehner

    Olivier Wehner - 2014-03-07

    When you specify file names in FAR (or the DOS console), then indeed a single asterisk means "any character, any number of times", such as in "*.html".

    Regular expressions however work differently. In particular there is no way to say "any number of times what comes after the asterisk". I'm not quite sure I understand what you are trying to do, but I'm confident it can be done. Please explain in more detail what you aim at.

    P.S. I'll edit the thread for better readability on the web page, making the now hidden html tags visible. This may lead to less readability in the email you receive.

     
  • Olivier Wehner

    Olivier Wehner - 2014-03-07
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,13 +1,13 @@
     Hi - I've used FAR extensively in the past to clean up html files. However, none of the search and replace I'm using is working - I've even got the original, but no luck.
     Some interface changes so not sure what I'm looking at any more, but it used to be very intuitive.
    
    -For example, just wanting to remove a string: <a name="_Toc375138174"></a>
    +For example, just wanting to remove a string: &lt;a name="_Toc375138174"&gt;&lt;/a&gt;
    
     so use Find:
    -<a name="_Toc375138174"></a>
    +&lt;a name="_Toc375138174"&gt;&lt;/a&gt;
    
     and Replace:
    -<a name="_Toc*"></a>
    +&lt;a name="_Toc*"&gt;&lt;/a&gt;
    
     I've tried using . and * - looking at your docs, I'm not quite clear - and turning on and off regular expressions.
    
     
  • Anonymous - 2014-04-08

    Hi there
    After computer crash, I'm not sure if I got this working but the help and regular expressions guidelines is not resolving.
    I want to replace a string, with numbers after "_Toc" in this example indicated by .* (dot star). It seems to find things once, but is this the right way to do this? I can't really tell what's going on, or whether these are the right characters (and why).
    <a name="_Toc.*"></a>
    An example of the whole string: <a name="_Toc38405"></a>
    This doesn't seem that complicated, and I used to do it in FAR all the time but something has changed and I don't know what's happening. Any help appreciated!
    I think it replaced all but one, but then couldn't find that one - which is not a big deal, but just would like to understand if my approach is correct.
    Thanks so much!

     
    Last edit: Olivier Wehner 2014-04-09
  • Olivier Wehner

    Olivier Wehner - 2014-04-09

    Your approach is perfectly alright.

    .* finds just any text (except line break). If you are sure it's only numbers you could use \d* (any number of digits) instead. Or use .+ (\d+) if at least one character (one digit) has to come after _Toc.

    Best regards

     
  • Olivier Wehner

    Olivier Wehner - 2014-07-01
    • status: open --> closed
     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks