TEXT   28
Notepad++ Regular Expressions
Guest on 3rd February 2023 01:41:01 PM


  1. Open the find/replace dialog.
  2. At the bottom will be some Search mode options.  Select "Extended (\n \r \t \0 \x...)" if doesn't work try "Regular Expression" instead
  3. In either the Find what or the Replace with field entries, you can use the following escapes:
  4. \n  new line (LF)
  5. \r   carriage return (CR)
  6. \t   tab character
  7. \0  null character
  8. \xddd   special character with code ddd
  9.  
  10.  
  11. - [!] finds the exclamation character.
  12.  
  13. - .* selects the rest of the line. (string.*string2 selects from string to string2)
  14.  
  15. - (\+.*)(Item) \+ finds the + character. | .* selects the text after the + up until the word "Item" | Item finds the string "Item" | () allow us to access whatever is inside the parentheses. The first set of parentheses may be accessed with \1 and the second set with \2.
  16.  
  17. - \1\r\n\2 will take + and whatever text comes after it, will then add a new line, and place the string "Item" on the new line.
  18.  
  19. - A-Z finds all letters of the alphabet in upper case.
  20.  
  21. - a-z finds all lower case letters.
  22.  
  23. - A-Za-z will find all alphabetic characters.
  24.  
  25. - [^...] is the inverse. So, if we put these three together: [^A-Za-z] finds any character except an alphabetic character.
  26.  
  27. - Notice that only one of the [^A-Za-z] is in parentheses (). This is recalled by \1 in the Replace with field. The characters outside of the parentheses are discarded.

Raw Paste

Login or Register to edit or fork this paste. It's free.