I was wondering if someone could help me. I am trying to figure out using regular expression to extract from all the text below in the example, each piece of 'abc11111111a05000~t.txt' and take a group from it which would only give me "abc11111111" and remove everything before and after each "abc11111111a05~t.txt". My plan is to have the result as follows: abc12345678;abc23456789;abc98765432;abc87654321
I have figured out all the scripting I need to get the result above, but I can't seem to get it to cleanly cut out everything before and/or after each. I am using the following expression: ([0-9a-zA-Z_.#\-]*)([a-zA-Z0-9]{3}[0-9]{3}~[0-9a-z\-]*\.[a-z]*)
When going through it in Step Mode, it also seems to convert newline paragraph marks 'P' during the regular expression into dots, and I can't figure out why.
Example:
hello dolly abc12345678a05000~t.txt hello dolly
hello dolly abc23456789a05000~t.txt
abc98765432a05000~t.txt hello dolly
abc87654321a05000~t.txt
Regular Expression Help
Re: Regular Expression Help
Then learn what non-capturing groups are, when to use greedy vs. lazy quantifiers and
how to make matches optional?
how to make matches optional?
Code: Select all
$samples = <<<>>>
hello dolly abc12345678a05000~t.txt hello dolly
hello dolly abc23456789a05000~t.txt
abc98765432a05000~t.txt hello dolly
abc87654321a05000~t.txt
>>>;
text trim(regexreplace($samples, "(?:.*?)([0-9a-zA-Z_.#\-]+?)([a-zA-Z0-9]{3}[0-9]{3}~.*?)(\r?\n|$)", "$1;", 1), ";", "R");
One of my scripts helped you out? Please donate via Paypal