Notepad++ wildcard

后端 未结 4 844
被撕碎了的回忆
被撕碎了的回忆 2021-02-08 01:17

how to find and replace all characters after the main domain (including the \"/\" character) using a wild card?

For example, i have the following 4 rows:



        
4条回答
  •  清酒与你
    2021-02-08 01:21

    In the Find and Replace dialog:

    • under Search Mode select Regular Expression
    • set Find What to /.*$
    • leave Replace With empty

    This is replace any slash and all the text after it until the end of line with nothing. It uses a regular expression so it looks convoluted but it is well worth learning as regular expressions are insanely useful for lots of things.

    Basically:

    • / isn't a special character so it just matches a /
    • . is a wildcard that matches a single character. To match a literal . use \.
    • * is a wildcard that matches zero of more of the preceding character. So a* would match zero or more a and .* would match zero of more of any character.
    • $ matches the end of a line. To match a literal $ use \$

    A few other special characters:

    • \ is the escape character - use it to turn special characters into normal characters. Yo match a literal \ use \\
    • + is a wildcard that matches one of more of the preceding character. So a+ would match one or more a and .+ would match one of more of any character.
    • ^ matches the start of a line. To match a literal ^ use \^
    • ( and ) make a match group. To match literal ( or ) use \( and \)

    And there are more special characters including [, ], { and } along with others that I won't mention.

提交回复
热议问题