xenium
asked on
REGEXEXTRACT to extract a subsection of text
Hiya, I recently came across the REGEXEXTRACT function in google docs but there is no documentation. I think it will do what i want though, that is to split a windows file path into parts based on searches eg:
C:\user\Dropbox\property\m aintenance & repairs\open\oddj smp1 slight leak through new window (normal).jpg
extract "open" with the rule: the text between the last two backslashes
extract "oddj" with the rule: from the last backslash to the next space
extract "smp1" with the rule: from "oddj" until the second space
extract "slight leak through new window" with the rule from "smp1" until the full stop (or space before if there is one)
extract "normal" with the rule text between the last set of brackets
Can anyone help with some or all of these? The rules can be bent as long as they give the correct answer in any similar example.
Thanks a million!
C:\user\Dropbox\property\m
extract "open" with the rule: the text between the last two backslashes
extract "oddj" with the rule: from the last backslash to the next space
extract "smp1" with the rule: from "oddj" until the second space
extract "slight leak through new window" with the rule from "smp1" until the full stop (or space before if there is one)
extract "normal" with the rule text between the last set of brackets
Can anyone help with some or all of these? The rules can be bent as long as they give the correct answer in any similar example.
Thanks a million!
ASKER
Item 3 extract "smp1" , the following almost does this except the bounding conditions are included in the result, how do i remove these?
=REGEXEXTRACT(fullpath, trade & "\w*\s")
Gives result: oddj smp1
I need just: smp1
Thanks again
=REGEXEXTRACT(fullpath, trade & "\w*\s")
Gives result: oddj smp1
I need just: smp1
Thanks again
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great thanks, that works straight off (bar typo in function name which is REGEXEXTRACT)
I'll have a look at the rest later as I have to dash now, but looks like that would work for a few of the points above. Meanwhile if you have any tips on any that maybe trickier feel free to post. cheers
I'll have a look at the rest later as I have to dash now, but looks like that would work for a few of the points above. Meanwhile if you have any tips on any that maybe trickier feel free to post. cheers
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks that works a treat! I'll have a closer look tomorrow and try to wrap up the rest too.
ASKER
This is powerful stuff, but i'm still struggling, could you help with the first and fourth cases too?
Maybe also some tips how to "read" such expressions. eg i think the following is the case for the last example, can you confirm/correct, also how the logic ties together..
Thanks again!
Maybe also some tips how to "read" such expressions. eg i think the following is the case for the last example, can you confirm/correct, also how the logic ties together..
Look for any character except closed parentheses:
[^)]
Return all characters except closed parentheses:
([^)]*)
Look for any number of characters:
.*
Look for open/closed parentheses:
\(
\)
Thanks again!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot for your help. That does the job for now. If i need to dig further I'll repost new questions.
ASKER
Many thanks for your help!
ASKER
https://www.experts-exchange.com/Programming/Languages/Regular_Expressions/A_2140-Regular-Expressions-Starter-Guide.html