How to change word and numerate this document!!
-
Hi all, a new challenger for me.
I have this text below:
(ANPA)In the classroom, a teacher observes the following characteristics in a 5-year-old student. Select the alternative that covers the most likely diagnostic hypothesis. A) Dyslexia B) Dysgraphia C) ADHD D) Dyscalculia E) Psychomotor disorder (ANPA) The neuropsychologist, in general, will be able to carry out diagnostic activities delimiting their activities in: I. Hospitals II. Schools III. Collective service spaces. IV. NGOs A) Only statement I is correct. B) Only statement II is correct. C) Only statements II and III are correct. D) Only statements I, II and III are correct. E) All statements are correct. (ANPA) Knowing the cause of learning difficulties, analyzing each of the aspects that involve are: I. Emotional aspects II. Affective aspects III. Pedagogical aspects IV. Neurological aspects A) Only statements I and II are correct. B) Only statements I and III are correct. C) Only statements I, III and IV are correct. D) Only statement III is correct. E) All statements are correct.
My texts always has (ANPA) before every question.
I want to replace the (ANPA) with QUESTION and number it.
Like: Question-01, Question-02, Question-03…Question-10
How to do this?
Thanks in advance
Claudio Raphael
-
@Claudio-Raphael said in How to change word and numerate this document!!:
I want to replace the (ANPA) with QUESTION and number it.
Notepad++'s built-in search-and-replace cannot do math (even a simple counter) to determine the replacement text. However, we have an entire FAQ entry for alternatives to get math-based replacements
Aside from the script-based solutions in the FAQ, for sequential-number-based solutions, we often recommend a multi-step sequence of events
- Use search-and-replace to merge groups of lines into one line (with some unused fancy character, maybe ¶ or ☺ used to indicate where internal newlines used to be)
- so maybe something like:
FIND =\R(?!\(ANPA\))
to find all newlines that aren’t followed by(ANPA)
REPLACE =¶
SEARCH MODE = Regular Expression
- so maybe something like:
- Use Edit > Column Mode (
Alt+select
) and Edit > Column Editor (Alt+C
) to auto-number the lines (you can tell it to use leading zeroes) - In your case, you would also want to do a search/replace after numbering, to change from
### (ANPA)
toQuestion-###
:- FIND =
^(\d+)\h*\(ANPA\)\h*
REPLACE =Question-$1\x20
(the\x20
will put a space between your question number and the text; you can just type a space instead of using the\x20
syntax.
If you want a colon or parenthesis between, you can insert that, too.)
SEARCH MODE = Regular Expression
- FIND =
- Use search-and-replace to put back in the original newlines:
- FIND =
¶
REPLACE =\r\n
(this is the Windows CRLF; if you have Linux end-of-lines, just use\n
SEARCH MODE = Regular Expression
- FIND =
- Use search-and-replace to merge groups of lines into one line (with some unused fancy character, maybe ¶ or ☺ used to indicate where internal newlines used to be)
-
@PeterJones said in How to change word and numerate this document!!:
@Claudio-Raphael said in How to change word and numerate this document!!:
I want to replace the (ANPA) with QUESTION and number it.
Notepad++'s built-in search-and-replace cannot do math (even a simple counter) to determine the replacement text. However, we have an entire FAQ entry for alternatives to get math-based replacements
Aside from the script-based solutions in the FAQ, for sequential-number-based solutions, we often recommend a multi-step sequence of events
- Use search-and-replace to merge groups of lines into one line (with some unused fancy character, maybe ¶ or ☺ used to indicate where internal newlines used to be)
- so maybe something like:
FIND =\R(?!\(ANPA\))
to find all newlines that aren’t followed by(ANPA)
REPLACE =¶
SEARCH MODE = Regular Expression
- so maybe something like:
- Use Edit > Column Mode (
Alt+select
) and Edit > Column Editor (Alt+C
) to auto-number the lines (you can tell it to use leading zeroes) - In your case, you would also want to do a search/replace after numbering, to change from
### (ANPA)
toQuestion-###
:- FIND =
^(\d+)\h*\(ANPA\)\h*
REPLACE =Question-$1\x20
(the\x20
will put a space between your question number and the text; you can just type a space instead of using the\x20
syntax.
If you want a colon or parenthesis between, you can insert that, too.)
SEARCH MODE = Regular Expression
- FIND =
- Use search-and-replace to put back in the original newlines:
- FIND =
¶
REPLACE =\r\n
(this is the Windows CRLF; if you have Linux end-of-lines, just use\n
SEARCH MODE = Regular Expression
- FIND =
Will try now.
Many thanks for great reply Sir PeterJones.
Claudio Raphael
- Use search-and-replace to merge groups of lines into one line (with some unused fancy character, maybe ¶ or ☺ used to indicate where internal newlines used to be)
-
If this is something that will come up more than once, and you’re open to trying a plugin that’s still in development, the newest features of Columns++ could help you here.
After installing the plugin, you would select the entire document, then select Search… from the Columns++ menu. Enter:
Find what:
\(ANPA\)\s*
Replace with:Question-(?=2:match)
(it’s not visible here, but put a space at the end of the replace text, after the final parenthesis — or else, whatever you want to come between the question number and the beginning of the text), and be sure Regular expression is selected, then use Replace All.
Documentation for this feature is here. The (?=…) defines a formula substitution in the replacement. The 2: makes the result use a minimum of two digits to the left of the decimal point. The expression match is a variable that represents the number of times, counting from one and including the current match, that the regular expression has matched.
-