• Login
Community
  • Login

How to change word and numerate this document!!

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 3 Posters 362 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C
    Claudio Raphael
    last edited by Claudio Raphael Sep 18, 2023, 1:23 PM Sep 18, 2023, 1:15 PM

    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

    P 1 Reply Last reply Sep 18, 2023, 1:46 PM Reply Quote 0
    • P
      PeterJones @Claudio Raphael
      last edited by PeterJones Sep 18, 2023, 1:59 PM Sep 18, 2023, 1:46 PM

      @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

      1. 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
      2. 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)
      3. In your case, you would also want to do a search/replace after numbering, to change from ### (ANPA) to Question-###:
        • 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
      4. 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
      C 1 Reply Last reply Sep 18, 2023, 2:02 PM Reply Quote 3
      • C
        Claudio Raphael @PeterJones
        last edited by Sep 18, 2023, 2:02 PM

        @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

        1. 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
        2. 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)
        3. In your case, you would also want to do a search/replace after numbering, to change from ### (ANPA) to Question-###:
          • 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
        4. 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

        Will try now.

        Many thanks for great reply Sir PeterJones.

        Claudio Raphael

        1 Reply Last reply Reply Quote 0
        • C
          Coises
          last edited by Sep 18, 2023, 5:57 PM

          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.

          C 1 Reply Last reply Sep 22, 2023, 10:14 AM Reply Quote 5
          • C
            Claudio Raphael @Coises
            last edited by Sep 22, 2023, 10:14 AM

            @Coises

            Sir, you are awesome!! Thank u very much.

            Claudio Raphael

            1 Reply Last reply Reply Quote 0
            5 out of 5
            • First post
              5/5
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors