I am on a health kick and weight loss program. Every day I am sending my daily log to a coach to help motivate and advise. I figured this would be good to try and automate as some things will be already present from teh previous day and others I enter in.
I am trying to scrape the previous day’s log to get things like yesterdays weight, todays day number etc but seem to be having some trouble getting it out. I thought that the shortcut “Match Text” would do a RegExp, and as such I thought I could get data out of it. For example from this text:
*Daily change(+/-): 0.1
*Step count: 16,222
I thought I could get the day number to increment. But when I use the “Match Text” operation it will return the entire match including what I put in. For example I am putting in
And I would like to just get the number 1 as I thought the parentheses would tell it to return that portion, but it returns “*Cycle: 1”.
How can I search text but return just what I want? Do I need to search again in the results? Or can I do it in one step?
I think if you add the action “Get Group from Matched Text” after your ‘Match Text” action that will achieve what you want. At least, it worked in my quick test. It’s still another action but at least you don’t need another Regex.
Yup, that’s what you need. Was gonna day the same thing .
Now can you help me with the RegExp and match start of line? I though that the ^ would match start of line, so “^*Cycle: (\d)” would give me what I want, but when I do that it returns nothing. Matching “*Cycle: (\d)” works ok so it seems to be an issue matching start of line. Any thoughts??
Shamelessly stolen from this discussion: https://www.reddit.com/r/workflow/comments/76jfct/regex_possible_to_match_beginning_of_any_line/
If you add ‘(?m)’ at the beginning this should work. I believe without this (a multi line flag) it will only match the first line.
Thanks for teaching me something today!
Ahhh. Thanks for that - I hadn’t twigged about setting it to multi line, nor how to actually do it. Thanks.
How can I escape ( ?
E.g. Daily change(+/-): 0.1
I try to use (, but don’t works
I have no idea
Thank in advance
The backslash character “\” is used to escape special characters.
Hope this helps.