FAQ: Template for Search/Replace Questions
-
FAQ Desk: Template for Search/Replace Questions
Hello, and welcome to the FAQ Desk. If you are reading this, you were likely directed here to get a template to use when asking a search, search-and-replace, regular expression, regex, mark, or other “change data that matches X” question.
You can copy the template below and paste it into your question in the Help Wanted section of the forum. Then go through and change anything that’s in ALL CAPS into something that’s meaningful for your question. Leave the special punctuation (` or ``` symbols especially), as they provide formatting for this forum that will help your message be understandable.
Template
Fellow Notepad++ Users, Could you please help me the the following search-and-replace problem I am having? DESCRIBE CIRCUMSTANCES OF YOUR QUESTION Here is the data I currently have ("before" data): ``` COPY/PASTE EXACT DATA HERE IT CAN HAVE MORE THAN ONE LINE MAKE SURE IT ACCURATELY REPRESENTS YOUR DATA, EVEN IF YOU HAVE TO CHANGE SOME THINGS (LIKE CHANGING NAMES OR ADDRESSES OR ACCOUNT NUMBERS): BUT IF YOU DO CHANGE SOMETHING, MAKE SURE THE STRUCTURE AND LOOK OF THE DATA IS STILL ACCURATELY REPRESENTED ``` Here is how I would like that data to look ("after" data): ``` PUT SIMILAR TEXT HERE, BUT THIS SHOULD LOOK LIKE THE END RESULT OF THE SEARCH-AND-REPLACE PROCESS ``` IF THERE IS SOMETHING THAT DOES NOT GET EXPRESSED WELL BY PASTING YOUR EXAMPLE TEXT BETWEEN THE ``` LINES ABOVE, PLEASE MAKE A SCREENSHOT OF YOUR NOTEPAD++ WINDOW AND PASTE IT HERE. BUT A PICTURE SHOULD ONLY ACCOMPANY YOUR EXAMPLE TEXT, YOU SHOULDN'T USE THE PICTURE IN PLACE OF YOUR EXAMPLE TEXT. To accomplish this, I have tried using the following Find/Replace expressions and settings * Find What = `SEARCH EXPRESSION HERE` * Replace With = `REPLACEMENT EXPRESSION HERE` * Search Mode = REGULAR EXPRESSION or NORMAL or EXTENDED * Dot Matches Newline = CHECKED or NOT CHECKED HERE IS WHY YOU THOUGHT YOUR EXPRESSION WOULD WORK Unfortunately, this did not produce the output I desired, and I'm not sure why. Could you please help me understand what went wrong and help me find the solution?
Hints / Guidelines
Obviously, you can feel free to include additional information not present in the template.
If you choose to leave out information from this template, it will be harder for people to answer your question, and you may get people pointing you back to this FAQ entry to provide more information.
Here are some other hints and guidelines for asking such questions:
- Be patient
- Be polite
- Show a willingness to learn
- Answer all requests for clarification
- Your example “before” and “after” data should include examples of data that should be changed, and example data that should not be changed by the replacement. Often, crafting a successful search/replace expression requires knowing both.
- If there are edge cases or exceptions, make sure your example data includes those
- When you share the expressions that you already tried, it’s good to explain why you thought it would work
- It really is important for the example “before” and “after” data to be as plain text, not just as a screenshot. Otherwise, fellow Notepad++ Community members cannot easily copy/paste your example data to experiment with the search/replace expressions.
Please note that the template above was written to try to encourage following these guidelines.
Caveat
Please note: This Community Forum is not a data transformation service; you should not expect to be able to always say “I have data like X and want it to look like Y” and have us do all the work for you. If you are new to the Forum, and new to regular expressions, we will often give help on the first few (one to three) data-transformation questions, especially if they are well-asked and you show a willingness to learn; and we will point you to the documentation where you can learn how to do the data transformations for yourself in the future. But if you repeatedly ask us to do your work for you, you will find that the patience of usually-helpful Community members wears thin. The best way to learn regular expressions is by experimenting with them yourself, and getting a feel for how they work; having us spoon-feed you the answers without you putting in the effort doesn’t help you in the long term and is uninteresting and annoying for us.
Related Resources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
T Terry R referenced this topic on Jul 4, 2022, 10:56 PM
-
-
-
-
-
-
-
T Terry R referenced this topic on Aug 7, 2022, 7:51 PM
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
L L S referenced this topic on Sep 26, 2022, 3:27 PM
-
-
-
-
-
С Сергей Рыбин referenced this topic on Oct 2, 2022, 1:57 PM
-
-
-
-
-
-
-
I Infinite referenced this topic on Oct 27, 2022, 4:11 PM
-
-
I Infinite referenced this topic on Oct 27, 2022, 4:54 PM
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
L Lycan Thrope referenced this topic on Jan 2, 2023, 1:18 AM
-
-
-
-
-
O Olivier Chantraine referenced this topic on Jan 19, 2023, 8:12 AM
-
-
-
-
-
-
-
F faouzi sat referenced this topic on Jan 31, 2023, 2:49 PM
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
L Lycan Thrope referenced this topic on Mar 15, 2023, 6:50 AM
-
-
-
-
-
T Terry R referenced this topic on Apr 18, 2023, 7:29 PM
-
-
T Terry R referenced this topic on May 8, 2023, 1:36 AM
-
S Saltshaker2112 referenced this topic on May 8, 2023, 1:48 AM
-
-
T Terry R referenced this topic on May 8, 2023, 7:50 PM
-
-
-
-
-
-
-
-
-
-
-
-
-
T Terry R referenced this topic on Jul 20, 2023, 1:05 AM
-
P PeterJones referenced this topic on Jul 20, 2023, 8:30 PM
-
A Alan Kilborn referenced this topic on Jul 21, 2023, 10:32 AM
-
P PeterJones referenced this topic on Aug 1, 2023, 1:04 PM
-
P PeterJones referenced this topic on Aug 2, 2023, 4:24 PM
-
P PeterJones referenced this topic on Aug 3, 2023, 3:10 PM
-
P PeterJones referenced this topic on Aug 6, 2023, 7:58 PM
-
A Alan Kilborn referenced this topic on Aug 7, 2023, 10:55 AM
-
P PeterJones referenced this topic on Aug 7, 2023, 5:48 PM
-
P PeterJones referenced this topic on Aug 28, 2023, 2:26 PM
-
P PeterJones referenced this topic on Sep 12, 2023, 2:12 PM
-
P PeterJones referenced this topic on Sep 16, 2023, 7:02 PM
-
P PeterJones referenced this topic on Sep 18, 2023, 4:14 PM
-
P PeterJones referenced this topic on Sep 19, 2023, 6:39 PM
-
P PeterJones referenced this topic on Oct 6, 2023, 5:41 PM
-
P PeterJones referenced this topic on Oct 9, 2023, 1:50 PM
-
P PeterJones referenced this topic on Oct 10, 2023, 12:57 PM
-
A Alan Kilborn referenced this topic on Oct 10, 2023, 1:14 PM
-
P PeterJones referenced this topic on Oct 10, 2023, 1:34 PM
-
A Alan Kilborn referenced this topic on Oct 15, 2023, 11:50 AM
-
P PeterJones referenced this topic on Oct 18, 2023, 7:51 PM
-
M mkupper referenced this topic on Oct 23, 2023, 4:44 PM
-
P PeterJones referenced this topic on Oct 25, 2023, 6:41 PM
-
P PeterJones referenced this topic on Oct 26, 2023, 8:14 PM
-
M mkupper referenced this topic on Oct 28, 2023, 5:58 PM
-
P PeterJones referenced this topic on Oct 28, 2023, 6:11 PM
-
P PeterJones referenced this topic on Oct 29, 2023, 9:25 PM
-
P PeterJones referenced this topic on Nov 3, 2023, 2:11 PM
-
P PeterJones referenced this topic on Nov 15, 2023, 2:10 PM
-
P PeterJones referenced this topic on Nov 15, 2023, 11:22 PM
-
A Alan Kilborn referenced this topic on Nov 21, 2023, 12:30 PM
-
P PeterJones referenced this topic on Nov 21, 2023, 2:04 PM
-
P PeterJones referenced this topic on Dec 3, 2023, 4:33 PM
-
P PeterJones referenced this topic on Dec 4, 2023, 10:05 PM
-
P PeterJones referenced this topic on Dec 7, 2023, 2:14 PM
-
P PeterJones referenced this topic on Dec 18, 2023, 6:12 PM
-
P PeterJones referenced this topic on Dec 19, 2023, 2:12 PM
-
P PeterJones referenced this topic on Dec 20, 2023, 6:47 PM
-
P PeterJones referenced this topic on Dec 26, 2023, 3:23 PM
-
M mkupper referenced this topic on Jan 14, 2024, 6:14 AM
-
P PeterJones referenced this topic on Jan 26, 2024, 8:17 PM
-
P PeterJones referenced this topic on Feb 5, 2024, 2:34 PM
-
P PeterJones referenced this topic on Feb 25, 2024, 2:09 PM
-
T Terry R referenced this topic on Feb 29, 2024, 7:59 PM
-
P PeterJones referenced this topic on Mar 3, 2024, 2:20 PM
-
P PeterJones referenced this topic on Mar 4, 2024, 2:39 PM
-
P PeterJones referenced this topic on Mar 23, 2024, 5:17 PM
-
P PeterJones referenced this topic on Mar 28, 2024, 5:36 PM
-
P PeterJones referenced this topic on Apr 10, 2024, 1:49 PM
-
P PeterJones referenced this topic on Apr 16, 2024, 4:41 PM
-
P PeterJones referenced this topic on Apr 28, 2024, 12:14 AM
-
P PeterJones referenced this topic on May 8, 2024, 6:14 PM
-
P PeterJones referenced this topic on May 13, 2024, 5:52 PM
-
P PeterJones referenced this topic on May 16, 2024, 12:55 PM
-
P PeterJones referenced this topic on May 21, 2024, 1:15 PM
-
P PeterJones referenced this topic on May 25, 2024, 10:55 PM
-
P PeterJones referenced this topic on May 31, 2024, 1:00 PM
-
P PeterJones referenced this topic on Jun 18, 2024, 6:00 PM
-
P PeterJones referenced this topic on Jun 27, 2024, 7:36 PM
-
P PeterJones referenced this topic on Jul 1, 2024, 7:54 PM
-
P PeterJones referenced this topic on Jul 4, 2024, 3:35 PM
-
P PeterJones referenced this topic on Jul 15, 2024, 1:48 PM
-
P PeterJones referenced this topic on Jul 15, 2024, 4:02 PM
-
P PeterJones referenced this topic on Jul 15, 2024, 7:51 PM
-
P PeterJones referenced this topic on Jul 23, 2024, 6:49 PM
-
P PeterJones referenced this topic on Jul 29, 2024, 8:30 PM
-
T Terry R referenced this topic on Jul 30, 2024, 10:25 PM
-
P PeterJones referenced this topic on Aug 1, 2024, 5:46 PM
-
P PeterJones referenced this topic on Aug 2, 2024, 2:06 PM
-
P PeterJones referenced this topic on Sep 20, 2024, 5:40 PM
-
P PeterJones referenced this topic on Sep 24, 2024, 5:59 PM
-
A Alan Kilborn referenced this topic on Sep 26, 2024, 4:38 PM
-
P PeterJones referenced this topic on Sep 29, 2024, 8:18 PM
-
P PeterJones referenced this topic on Oct 9, 2024, 7:42 PM
-
P PeterJones referenced this topic on Oct 11, 2024, 5:26 PM
-
A Alan Kilborn referenced this topic on Oct 18, 2024, 11:29 AM
-
P PeterJones referenced this topic on Oct 25, 2024, 6:39 PM
-
P PeterJones referenced this topic on Nov 8, 2024, 6:07 PM
-
P PeterJones referenced this topic on Nov 11, 2024, 2:06 PM
-
P PeterJones referenced this topic on Nov 19, 2024, 3:50 PM
-
T Terry R referenced this topic on Nov 28, 2024, 3:56 AM
-
P PeterJones referenced this topic on Dec 1, 2024, 6:56 PM
-
P PeterJones referenced this topic on Dec 4, 2024, 8:35 PM
-
P PeterJones referenced this topic on Dec 16, 2024, 4:12 PM
-
T Terry R referenced this topic on Dec 17, 2024, 2:01 AM
-
P PeterJones referenced this topic on Dec 18, 2024, 8:43 PM
-
T Terry R referenced this topic on Jan 14, 2025, 10:24 PM
-
M Mark Olson referenced this topic on Jan 16, 2025, 6:53 AM
-
T Terry R referenced this topic on Feb 10, 2025, 9:31 PM
-
T Terry R referenced this topic on Mar 20, 2025, 8:09 PM
-
T Terry R referenced this topic on Apr 3, 2025, 11:55 PM