Menu

#97 Can't find links and images

None
closed
None
3
2023-09-21
2017-08-22
Anonymous
No

Hello Olivier. I'm sorry for the silly question, I have no problem finding and replacing plain text in html files, however, FAR can't find some images paths with absolute url's, surrounded by html tags with a class. I have ticked and unticked regular expressions, and still cannot find any items. Any help would be appreciated, thank you.

1 Attachments

Discussion

  • Olivier Wehner

    Olivier Wehner - 2017-08-22

    Hi there,

    at first guess I see two possible pitfalls:

    1) Whitespace: If the file contains a tab or line break or two spaces where the search text has only one, the search will fail. To overcome this, replace every space in the search text with \s+ (= at least one whitespace character) and leave the Regular Expression checkbox checked.

    However, since you probably copied the original text right into the search box, something else seems to be more plausible:

    2) Encoding: The cedilla in "Français" has a different byte code representation in utf-8 and iso-latin-1 (or cp1252). Replace it with .+ (dot = any character) and leave the Regular Expression checkbox checked.

    Or follow these instructions below:
    First find out the encoding of your target file. You can open it in FARs build in Editor (right mouse button on file list) or in some other Editor that lets you change the display encoding (aka character set), such as Notepad++. If you change between utf-8 on the one hand and iso-8859-1 / windows-1252 on the other, the cedilla will show only in one. That is the (real) file encoding.
    Then go to FAR > Settings > File Types in the FAR menu bar and settings dialog and select text/html from the first drop down list. The encoding that is displayed should be that of the target file (this is the encoding FAR uses to read html files). Change it if it does not match and don't forget to click Save.

    Hope that helps.

    Olivier

     
  • Anonymous

    Anonymous - 2017-08-29

    Thank you, it's working, I have changed the preferences and could use the .+ trick for any "special character" like accent or cedilla. However I'm stuck on cyrillic, here is my code:

    <img alt="ру́сский язы́к" src="http://mysite.com/images/ru.png" class="flags" />
    

    I've tried to place 7 times .+ followed by a space and another 4 .+ but FAR cannot find this line in my list. Is there any code I could use to recognize this line please ?

     
  • Olivier Wehner

    Olivier Wehner - 2017-09-04

    The .+ notation means "any number of characters but at least once". To capture the cyrillic text rather use something like
    alt="[^"]+"
    where [^"] means "any character but double quotes" and + means again "at least once". Please consult the FAR build in help for further details, especially the regular expression manual.

    Best regards,

    Olivier

     
  • Olivier Wehner

    Olivier Wehner - 2020-11-20
    • status: open --> closed
    • Group: -->
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB