Skip to content

Commit f93fa28

Browse files
committed
differences for PR #245
1 parent 5853e0b commit f93fa28

File tree

2 files changed

+57
-3
lines changed

2 files changed

+57
-3
lines changed

01-regular-expressions.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,66 @@ Organike
9494
Or, any other string that starts a line, begins with a letter `o` in lower or capital case, proceeds with `rgani`, has any character in the 7th position, and ends with the letter `e`.
9595
[See solution visualised on Regexper.com](https://regexper.com/#%5E%5BOo%5Drgani.e%5Cb)
9696

97-
98-
9997
:::::::::::::::::::::::::
10098

10199
::::::::::::::::::::::::::::::::::::::::::::::::::
102100

101+
## Getting help with regular expressions
102+
103+
Although powerful, the mix of special and regular characters in a regular expression can make them difficult to interpret and to troubleshoot when we get them wrong.
104+
The [Regexper](https://regexper.com) tool linked in the solution above visualises and annotates a regular expression provided by the user, which can be very helpful as you learn to read and write them.
105+
Other online tools such as [Regex101](https://regex101.com/) provide a more powerful -- and more complex! -- interface that can help you develop a regular expression to fit your use case.
106+
107+
If you get stuck when writing a regular expression, it is helpful to prepare a collection of "test strings": words, sentences, or other blocks of text that represent the things you do _and do not_ want to match.
108+
To test for matches you do not want, think about words/sentences/text that is similar to the matches you _do_ want to make, and include those in your test strings.
109+
For example, you might include "disorganised" in a set of test strings for the regular expression in the exercise above, if you only wanted to match whole words.
110+
111+
Paste your test strings into a new file in your favourite text editor or the _Test String_ box on Regex101 then paste or compose your regular expression to see which of these test strings are matched.
112+
113+
As well as trying to figure things out on your own, you might also get help by talking to somebody!
114+
If you have a colleague or friend with more expertise in regular expressions than you have, show them the problem you are having and ask them for help.
115+
Sometimes, the act of articulating your question can help you to identify what is going wrong.
116+
This is known as ["rubber duck debugging"](https://en.wikipedia.org/wiki/Rubber_duck_debugging) among programmers.
117+
118+
### Generative AI
119+
120+
::::::::::::::::::::::::::::: instructor
121+
122+
### Choose how to teach this section
123+
The section on generative AI is intended to be concise but Instructors may choose to devote more time to the topic in a workshop.
124+
Depending on your own level of experience and comfort with talking about and using these tools, you could choose to do any of the following:
125+
126+
* Explain how large language models work and are trained, and/or the difference between generative AI, other forms of AI that currently exist, and the limits of what LLMs can do (e.g., they can't "reason").
127+
* Demonstrate how you recommend that learners use generative AI.
128+
* Discuss the ethical concerns listed below, as well as others that you are aware of, to help learners make an informed choice about whether or not to use generative AI tools.
129+
130+
This is a fast-moving technology.
131+
If you are preparing to teach this section and you feel it has become outdated, please open an issue on the lesson repository to let the Maintainers know and/or a pull request to suggest updates and improvements.
132+
133+
::::::::::::::::::::::::::::::::::::::::
134+
135+
It is increasingly common for people to use _generative AI_ chatbots such as ChatGPT to get help with regular expressions.
136+
You will probably receive some useful guidance by presenting your regular expression to the chatbot and asking why it matches (or does not match) a given string.
137+
However, the way this help is provided by the chatbot is different from that provided by a human.
138+
Generative AI chatbots, which are based on an advanced statistical model, respond by generating the _most likely_ sequence of text that would follow the prompt they are given.
139+
140+
While responses from generative AI tools can often be helpful, they are not always reliable.
141+
These tools sometimes generate plausible but incorrect or misleading information, so (just as with an answer found on the internet or shared with you by somebody else) it is essential to verify their accuracy.
142+
You need the knowledge and skills to be able to understand these responses, to judge whether or not they are accurate, and to fix any errors in the regular expression the chatbot offers you.
143+
144+
In addition to asking for help, generative AI tools can be used to generate regular expressions from scratch (especially when given clear and precise instructions and examples); extend, improve and reorganise existing regular expressions; and more.
145+
However, there are drawbacks that you should be aware of.
146+
147+
The models used by these tools have been "trained" on very large volumes of data, much of it taken from the internet, and the responses they produce reflect that training data, and may recapitulate its inaccuracies or biases.
148+
The environmental costs (energy and water use) of LLMs are a lot higher than other technologies, both during development (known as training) and when an individual user uses one (also called inference). For more information see the [AI Environmental Impact Primer](https://huggingface.co/blog/sasha/ai-environment-primer) developed by researchers at HuggingFace, an AI hosting platform.
149+
Concerns also exist about the way the data for this training was obtained, with questions raised about whether the people developing the LLMs had permission to use it.
150+
Other ethical concerns have also been raised, such as reports that workers were exploited during the training process.
151+
152+
**We recommend that you avoid getting help from generative AI during the workshop** because the foundational knowledge and skills you will learn in this lesson by writing and fixing your own regular expressions are essential to be able to evaluate the correctness and safety of any answers you receive from other people or a generative AI chatbot.
153+
If you choose to use these tools in the future, the expertise you gain from learning and practising these fundamentals on your own will help you use them more effectively.
154+
155+
### More special characters
156+
103157
Other useful special characters are:
104158

105159
- `*` matches the preceding element zero or more times. For example, ab\*c matches "ac", "abc", "abbbc", etc.

md5sum.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"LICENSE.md" "b24ebbb41b14ca25cf6b8216dda83e5f" "site/built/LICENSE.md" "2023-05-03"
44
"config.yaml" "cd55856a02dcd0fae982a33c849a5afa" "site/built/config.yaml" "2024-12-09"
55
"index.md" "2af31ad735fde7f32cb5b1ec9739dac6" "site/built/index.md" "2024-12-09"
6-
"episodes/01-regular-expressions.md" "a99a9eb670c86dd62b92c5dfd4ae8938" "site/built/01-regular-expressions.md" "2024-09-30"
6+
"episodes/01-regular-expressions.md" "b5c79d20ce0a37680dc1b5f5303eed3b" "site/built/01-regular-expressions.md" "2025-04-30"
77
"episodes/02-match-extract-strings.md" "d47fea09e2ff56810f19a2f3fc4fa7f3" "site/built/02-match-extract-strings.md" "2024-10-15"
88
"episodes/03-quiz.md" "d792071b0625440049c454e9e653cd2d" "site/built/03-quiz.md" "2023-05-03"
99
"episodes/04-exercises.md" "d1ff48c58540f0dd04bf7d199924bde4" "site/built/04-exercises.md" "2023-05-03"

0 commit comments

Comments
 (0)