Yes. This is a fairly easy RegEx, but I have designed one to be specific to "Read Chapers" but then to allow flexibility in the separation of the chapter numbers:
(?i)Read Chapters\h+(\d+)[\h\-]+(\d+)
Just so you know, it could be as simple as:
(\d+).+?(\d+)
This just looks for the first two numbers in the string.
I find it best to develop and test RegEx patterns using a tool like Regex101.com
You use a Search using Regular Expression action to extract the start and end chapter number using RegEx Capture Groups.
Then you can use those two KM Variables in a For Each action, which is just a type of repeat loop you see in many languages.
Here's a complete example macro to help get you started.
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
Please let us know if it meets your needs.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Example Output
MACRO: Looping Through a Range of Numbers [Example]
-~~~ VER: 1.0 2020-09-28 ~~~
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
DOWNLOAD Macro File:
Looping Through a Range of Numbers [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
ReleaseNotes
Macro Author: @JMichaelTX
This is just an example written in response to the below KM Forum Topic. You will need to use as an example and/or change to meet your workflow automation needs.
MACRO SETUP
- Carefully review the Release Notes and the Macro Actions
- Make sure you understand what the Macro will do.
- You are responsible for running the Macro, not me.
Make These Changes to this Macro
- Assign a Trigger to this macro.
- Move this macro to a Macro Group that is only Active when you need this Macro.
- ENABLE this Macro, and the Macro Group it is in.
.
- REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
(all shown in the magenta color)
- Set Source String
- The text you start with,to be processed
- Set Variable “Local__Root”
- The text used in the output for each line. "Read Chapter " in this case.
REQUIRES:
- KM 9.0+ (may work in KM 8.2+ in some cases)
- macOS 10.11.6 (El Capitan)+
TAGS: @Regex @Loop @ForEa