Howard, you would need to have this in Replace:
MC\t"\1\2\2\3\4\4\5"\tChoice 1\tIncorrect\6\tChoice 2\tIncorrect\7\tChoice
3\tIncorrect\8\tChoice 4\tIncorrect\9
Your replace field shows the desired outcome, not the Replace element of
the regex.
Rick Gordon
On Friday, September 15, 2023 at 8:01:49 AM UTC-7 anotherhoward wrote:
> I pasted your first REGEX code and the relevant input into Pattern
> Playground in both the Find and Replace sections and nothing is happening.
> When I click Next, I just get a beep and am getting the message "No matches
> found." I've checked everything and it matches what's in your post in this
> forum. What could I be doing wrong?
> Howard
>
> [image: Gordon REGEX (1).png]
> On Thursday, September 14, 2023 at 7:49:03 PM UTC-4 Rick Gordon wrote:
>
>> This will require two regexes, which could be set up as a text factory.
>>
>> The first will handle everything except for the Correct field. It is:
>>
>> --
>> FIND:
>> (?:^\d+\.\h+)([^"\r]+)("?)([^"\r]+)("?)(.+)\r\h+(?:a\)\h)(?:[^{\r]+)(\{C\})?\r\h+(?:b\)\h)(?:[^{\r]+)(\{C\})?\r\h+(?:c\)\h)(?:[^{\r]+)(\{C\})?\r\h+(?:d\)\h)(?:[^{\r]+)(\{C\})?\r\h*
>>
>>
>>
>> REPLACE:
>> MC\t"\1\2\2\3\4\4\5"\tChoice 1\tIncorrect\6\tChoice
>> 2\tIncorrect\7\tChoice 3\tIncorrect\8\tChoice 4\tIncorrect\9
>> --
>>
>> That would change this:
>>
>> 1. Why is the "Description" component important when reflecting on
>> sports?
>> a) It helps you set future goals.
>> b) It provides context and sets the stage for reflection.
>> c) It summarizes the main lessons learned. {C}
>> d) It assesses the positive and negative aspects.
>>
>> 2. Why is the "Evaluation" component important?
>> a) This is choice one. {C}
>> b) This is choice two.
>> c) This is choice three.
>> d) This is choice four.
>>
>> 10. Why is the "Analysis" component important?
>> a) This is choice one.
>> b) This is choice two.
>> c) This is choice three.
>> d) This is choice four. {C}
>>
>> …to this:
>>
>> MC "Why is the ""Description"" component important when reflecting on
>> sports?" Choice 1 Incorrect Choice 2 Incorrect Choice 3
>> Incorrect{C} Choice 4 Incorrect
>> MC "Why is the ""Evaluation"" component important?" Choice 1
>> Incorrect{C} Choice 2 Incorrect Choice 3 Incorrect Choice
>> 4 Incorrect
>> MC "Why is the ""Analysis"" component important?" Choice 1
>> Incorrect Choice 2 Incorrect Choice 3 Incorrect Choice 4
>> Incorrect{C}
>> --
>>
>> Then, a second regex:
>> --
>> FIND:
>> Incorrect\{C\}
>>
>> REPLACE:
>> Correct
>> --
>>
>> …would change the field for the correct answer.
>>
>> Rick Gordon
>>
>> On Thursday, September 14, 2023 at 7:13:58 AM UTC-7 anotherhoward wrote:
>>
>>>
>>> Here is new input updated to indicate the correct answer {C} in each
>>> multiple-choice question.
>>>
>>> 1. Why is the "Description" component important when reflecting on
>>> sports?
>>> a) It helps you set future goals.
>>> b) It provides context and sets the stage for reflection.
>>> c) It summarizes the main lessons learned. {C}
>>>
>>> d) It assesses the positive and negative aspects.
>>>
>>> 2. Why is the "Evaluation" component important?
>>> a) This is choice one.
>>> b) This is choice two. {C}
>>>
>>> c) This is choice three.
>>> d) This is choice four.
>>>
>>> 10. Why is the "Analysis" component important?
>>> a) This is choice one.
>>> b) This is choice two.
>>> c) This is choice three. {C}
>>>
>>> d) This is choice four.
>>> On Thursday, September 14, 2023 at 12:29:54 AM UTC-4 David G Wagner
>>> wrote:
>>>
>>>> I am not the best at regex, but the thought of how to indicate what was
>>>> correct was really all I was offering. If no one comes forward with a
>>>> solution, then would give it shot for you.
>>>>
>>>>
>>>> Wags ;)
>>>>
>>>> WagsWorld
>>>> Hebrews 4:15
>>>> Ph(primary) : 408-914-1341 <(408)%20914-1341>
>>>> Ph(secondary): 408-761-7391 <(408)%20761-7391>
>>>>
>>>> On Sep 13, 2023 at 15:38 -0700, 'anotherhoward' via BBEdit Talk <
>>>> [email protected]>, wrote:
>>>>
>>>> David,
>>>> That sounds like a viable solution. I'm open to that idea. Do I have to
>>>> do anything to my submission for it to be done the way you suggested?
>>>> Howard
>>>>
>>>> On Wednesday, September 13, 2023 at 6:08:55 PM UTC-4 David G Wagner
>>>> wrote:
>>>>
>>>>> That is still a lot of work on your end. Why not use a square bracket
>>>>> or } as the correct answer then it should be handled in hopefully one
>>>>> pass
>>>>> and no one is doing extra work. Just thought…
>>>>>
>>>>> Wags ;)
>>>>>
>>>>> WagsWorld
>>>>> Hebrews 4:15
>>>>> Ph(primary) : 408-914-1341 <(408)%20914-1341>
>>>>> Ph(secondary): 408-761-7391 <(408)%20761-7391>
>>>>>
>>>>> On Sep 13, 2023 at 11:55 -0700, 'anotherhoward' via BBEdit Talk <
>>>>> [email protected]>, wrote:
>>>>>
>>>>>
>>>>> Hi Bruce,
>>>>>
>>>>> I misunderstood what was being asked and appreciate the time you put
>>>>> into your response. I do have a separate answer file for each of my
>>>>> tests.
>>>>> Further, in the forum, l only underlined the correct answers’ text
>>>>> because
>>>>> I thought that was the information I was being asked for. My school’s LMS
>>>>> will grade the exams for me once I supply it with the correct answers,
>>>>> which is easy for me to do.
>>>>>
>>>>> To make things easier here, as most of my tests contain no more than
>>>>> 20 multiple-choice questions, for now, in the reformat, please just use
>>>>> for
>>>>> all the possible answers for each question (there are four, from
>>>>> Choice 1 to Choice 4), the word “Incorrect.” Then, once I have the
>>>>> code that will enable me to reformat a specific test’s questions, it
>>>>> should
>>>>> take me only a few minutes in BBEdit to change the correct answer in each
>>>>> question from “Incorrect” to “Correct.”
>>>>>
>>>>> Please let me know if you have any questions about what I wrote.
>>>>>
>>>>> Howard
>>>>> On Wednesday, September 13, 2023 at 1:44:00 PM UTC-4 Bruce Van Allen
>>>>> wrote:
>>>>>
>>>>>> anotherhoward,
>>>>>>
>>>>>> So you’re saying that the input text will have the correct answers
>>>>>> for each question underlined?
>>>>>>
>>>>>> This seems challenging:
>>>>>>
>>>>>> * A regular expression will not detect text formatting such as
>>>>>> underlining - in fact in plain text such as what we work with in BBEdit,
>>>>>> there IS no underlining. Some word processors allow searching by text
>>>>>> formatting; whether they’re scriptable I don’t know.
>>>>>>
>>>>>> * It’s your work :), but it seems tedious to have to manually
>>>>>> underline or otherwise mark the correct answers for each of up to 99
>>>>>> questions, especially if the only reason to do so is to help with this
>>>>>> transformation. When I’ve built quizzes, the answers are in a separate
>>>>>> index file that is programmatically accessible for grading quizzes; such
>>>>>> a
>>>>>> thing would also be useful for the kind of script that could transform
>>>>>> your
>>>>>> input into your desired output.
>>>>>>
>>>>>> # Answers_Quiz_016.txt
>>>>>> Q A
>>>>>> 1 a
>>>>>> 2 c
>>>>>> 3 a
>>>>>> 4 d
>>>>>> 5 c
>>>>>> ...
>>>>>>
>>>>>>
>>>>>> * I suppose this is also a matter of what control you have over the
>>>>>> input - the set of questions and the knowledge/designation of the
>>>>>> correct
>>>>>> answers. Also, how frequently you have to do this.
>>>>>>
>>>>>> More description?
>>>>>>
>>>>>> — Bruce
>>>>>>
>>>>>> _bruce__van_allen__santa_cruz_ca_
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> > On Sep 13, 2023, at 10:11 AM, 'anotherhoward' via BBEdit Talk <
>>>>>> [email protected]> wrote:
>>>>>> >
>>>>>> >
>>>>>> > Bruce,
>>>>>> >
>>>>>> > Please look at my last response, and let me know if that’s provides
>>>>>> the needed information.
>>>>>> >
>>>>>> > Thanks,
>>>>>> > Howard
>>>>>> > On Wednesday, September 13, 2023 at 1:06:21 PM UTC-4 Bruce Van
>>>>>> Allen wrote:
>>>>>> > Here’s what I think what Kevin is getting at: if you want a
>>>>>> generalized method that works for every/any question, not just the three
>>>>>> in
>>>>>> your example, then that method has to know which answer to designate as
>>>>>> correct.
>>>>>> >
>>>>>> > E.g., you’ve said there can be as many as 99 questions; which
>>>>>> answer for question 3 would be the correct one? For question 4? etc.
>>>>>> >
>>>>>> > There’s nothing in image 1 (the input) that indicates whether a),
>>>>>> b), c), or d) is the correct answer for each question.
>>>>>> >
>>>>>> > — Bruce
>>>>>> >
>>>>>> > _bruce__van_allen__santa_cruz_ca_
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > > On Sep 13, 2023, at 9:55 AM, 'anotherhoward' via BBEdit Talk <
>>>>>> [email protected]> wrote:
>>>>>> > >
>>>>>> > > Kevin,
>>>>>> > > Is this of help? I’ve underlined the correct answers in the input.
>>>>>> > > Howard
>>>>>> > >
>>>>>> > > Here is the input in text format:
>>>>>> > > 1. Why is the "Description" component important when reflecting
>>>>>> on sports?
>>>>>> > > a) It helps you set future goals.
>>>>>> > > b) It provides context and sets the stage for reflection.
>>>>>> > > c) It summarizes the main lessons learned.
>>>>>> > > d) It assesses the positive and negative aspects.
>>>>>> > >
>>>>>> > > 2. Why is the "Evaluation" component important?
>>>>>> > > a) This is choice one.
>>>>>> > > b) This is choice two.
>>>>>> > > c) This is choice three.
>>>>>> > > d) This is choice four.
>>>>>> > >
>>>>>> > > 10. Why is the "Analysis" component important?
>>>>>> > > a) This is choice one.
>>>>>> > > b) This is choice two.
>>>>>> > > c) This is choice three.
>>>>>> > > d) This is choice four.
>>>>>> > >
>>>>>> > > On Wednesday, September 13, 2023 at 12:51:46 PM UTC-4
>>>>>> anotherhoward wrote:
>>>>>> > > Kevin,
>>>>>> > >
>>>>>> > > The correct answers are shown in Image 2.
>>>>>> > >
>>>>>> > > Here are the correct answers:
>>>>>> > > Question 1: C
>>>>>> > > Question 2: B
>>>>>> > > Question 3: C
>>>>>> > >
>>>>>> > > HowardOn Wednesday, September 13, 2023 at 12:34:59 PM UTC-4 Kevin
>>>>>> Shay wrote:
>>>>>> > > How do you know which answer is correct for each question?
>>>>>> > >
>>>>>> > > On Wed, Sep 13, 2023 at 11:32 AM 'anotherhoward' via BBEdit Talk <
>>>>>> [email protected]> wrote:
>>>>>> > > The image below (IMAGE 1) shows a sample of the original format
>>>>>> of the multiple choice questions I need to convert into another format.
>>>>>> As
>>>>>> there could be from 10-99 of them, I made the third sample #10 so that
>>>>>> one
>>>>>> has a double-digit number.
>>>>>> > >
>>>>>> > > If the solution can be presented in REGEX, that would be helpful;
>>>>>> however, I am open to other solutions.
>>>>>> > >
>>>>>> > > Howard
>>>>>> > >
>>>>>> > > IMAGE 1
>>>>>> > >
>>>>>> > > The image after this one (IMAGE 2) shows how I need the first
>>>>>> image's contents reformatted.
>>>>>> > >
>>>>>> > > Here is the input in text format:
>>>>>> > > 1. Why is the "Description" component important when reflecting
>>>>>> on sports?
>>>>>> > > a) It helps you set future goals.
>>>>>> > > b) It provides context and sets the stage for reflection.
>>>>>> > > c) It summarizes the main lessons learned.
>>>>>> > > d) It assesses the positive and negative aspects.
>>>>>> > >
>>>>>> > > 2. Why is the "Evaluation" component important?
>>>>>> > > a) This is choice one.
>>>>>> > > b) This is choice two.
>>>>>> > > c) This is choice three.
>>>>>> > > d) This is choice four.
>>>>>> > >
>>>>>> > > 10. Why is the "Analysis" component important?
>>>>>> > > a) This is choice one.
>>>>>> > > b) This is choice two.
>>>>>> > > c) This is choice three.
>>>>>> > > d) This is choice four.
>>>>>> > >
>>>>>> > > Here is how I need the first image's contents reformatted.
>>>>>> > >
>>>>>> > > IMAGE 2
>>>>>> > >
>>>>>> > > In the reformat:
>>>>>> > > 1. Each item starts with "MC."
>>>>>> > > 2. Immediately after "MC" is the multiple-choice question.
>>>>>> > > 3. Then, for each item, there are the four possible answers, from
>>>>>> "Choice 1" to "Choice 4."
>>>>>> > > 5. Each possible answer is followed by "Correct" (once) and
>>>>>> "Incorrect" (three times), with the position of "Correct" varying.
>>>>>> > > 6. Each of an item's components except its last one needs to be
>>>>>> followed by a TAB press. The last one in each item is followed by a
>>>>>> RETURN.
>>>>>> > >
>>>>>> > >
>>>>>> > > --
>>>>>> > > This is the BBEdit Talk public discussion group. If you have a
>>>>>> feature request or need technical support, please email "
>>>>>> [email protected]" rather than posting here. Follow @bbedit on
>>>>>> Twitter: <https://twitter.com/bbedit>
>>>>>> > > ---
>>>>>> > > You received this message because you are subscribed to the
>>>>>> Google Groups "BBEdit Talk" group.
>>>>>> > > To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> > > To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/bbedit/c26f2d21-c067-4489-8c90-0b9e7475c80dn%40googlegroups.com
>>>>>> .
>>>>>> > >
>>>>>> > > --
>>>>>> > > This is the BBEdit Talk public discussion group. If you have a
>>>>>> feature request or need technical support, please email "
>>>>>> [email protected]" rather than posting here. Follow @bbedit on
>>>>>> Twitter: <https://twitter.com/bbedit>
>>>>>> > > ---
>>>>>> > > You received this message because you are subscribed to the
>>>>>> Google Groups "BBEdit Talk" group.
>>>>>> > > To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> > > To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/bbedit/077eb64d-c854-42ca-87d0-628d6a15e92dn%40googlegroups.com
>>>>>> .
>>>>>> >
>>>>>> >
>>>>>> > --
>>>>>> > This is the BBEdit Talk public discussion group. If you have a
>>>>>> feature request or need technical support, please email "
>>>>>> [email protected]" rather than posting here. Follow @bbedit on
>>>>>> Twitter: <https://twitter.com/bbedit>
>>>>>> > ---
>>>>>> > You received this message because you are subscribed to the Google
>>>>>> Groups "BBEdit Talk" group.
>>>>>> > To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> > To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/bbedit/70132027-fcfd-49e2-ad33-da99f628543en%40googlegroups.com
>>>>>> .
>>>>>>
>>>>>> --
>>>>> This is the BBEdit Talk public discussion group. If you have a feature
>>>>> request or need technical support, please email "[email protected]"
>>>>> rather than posting here. Follow @bbedit on Twitter: <
>>>>> https://twitter.com/bbedit>
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "BBEdit Talk" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>>
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/bbedit/1d41f9ae-34ee-43bc-833e-1529d3467d28n%40googlegroups.com
>>>>>
>>>>> <https://groups.google.com/d/msgid/bbedit/1d41f9ae-34ee-43bc-833e-1529d3467d28n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> --
>>>> This is the BBEdit Talk public discussion group. If you have a feature
>>>> request or need technical support, please email "[email protected]"
>>>> rather than posting here. Follow @bbedit on Twitter: <
>>>> https://twitter.com/bbedit>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "BBEdit Talk" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>>
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/bbedit/5e32c0a4-942c-4dca-85a4-ad1ca2d680b6n%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/bbedit/5e32c0a4-942c-4dca-85a4-ad1ca2d680b6n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>>
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" rather than
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/287901f7-6dc2-4877-ba00-4f3710d29c07n%40googlegroups.com.