Im trying to create a regex function that gives me the string between 2 characters
I have the string below
word1/word2/word3/word4/word5/word6/word7/word8_length_string.txt
and I'm trying to return everything after the 7th instance of "_" and before ".txt"
is there a regex function within the regex tool I can use to accomplish this?
Solved! Go to Solution.
Hey sorry, I should have put my actual the example below is the format in which my real string is in but when I used your regex code it didnt work
so the example below is the format in which my actual string is in
00000000000000000000000000000000000000000000000000006666666666666 NACC-alteryxamp040320231500 [03/May/2024:16:04:45 +0000] 50.19.145.90 arn:aws:iam::449661041955:user/uploading-prod-app WWWWWWWWTTTYY REST.PUT.OBJECT uploading/NACC/AAAA/Inbound/filename_AAAA_uploading_files_string_20240503160217.txt.pgp "PUT /uploading/NACC/AAAA/Inbound/filename_AAAA_uploading_files_string_20240503160217.txt.pgp HTTP/1.1" 200 - - 121267 155 116 "-" "server3/1.9.57 Python/3.7.7 Linux/3.10.0-1160.95.1.el7.x86_64 newcore/1.12.86 Resource" - 73g2iMGiGECVq5L4EtEGpKURXQT/jbamYYrT02+aiQ9IPcHb0RpNPhldKk6ubbjYotEe5/QFN7I= SigV4 ECDHE-RSA-AES128-GCM-SHA256 AuthHeader NACC-alteryxamp040320231500.s3.amazonaws.com TLSv1.2 - -
I've highlighted my delimiters in pink and what I'm trying to pull in blue, so I want everything between the 7th instance of / and the first instance of txt.
shouldn't the code the provided work? I tried it with this as my string field and it didn't work, I saw it worked for the other example, not sure why this would be different
@AbdulBalogun another regex
Use RegEx and try this expression : (?:.*?[_/]){7}(.*?)\.txt
This should work.
Thanks that worked!
similarly in the same code of
00000000000000000000000000000000000000000000000000006666666666666 NACC-alteryxamp040320231500 [03/May/2024:16:04:45 +0000] 50.19.145.90 arn:aws:iam::449661041955:user/uploading-prod-app WWWWWWWWTTTYY REST.PUT.OBJECT uploading/NACC/AAAA/Inbound/filename_AAAA_uploading_files_string_20240503160217.txt.pgp "PUT /uploading/NACC/AAAA/Inbound/filename_AAAA_uploading_files_string_20240503160217.txt.pgp HTTP/1.1" 200 - - 121267 155 116 "-" "server3/1.9.57 Python/3.7.7 Linux/3.10.0-1160.95.1.el7.x86_64 newcore/1.12.86 Resource" - 73g2iMGiGECVq5L4EtEGpKURXQT/jbamYYrT02+aiQ9IPcHb0RpNPhldKk6ubbjYotEe5/QFN7I= SigV4 ECDHE-RSA-AES128-GCM-SHA256 AuthHeader NACC-alteryxamp040320231500.s3.amazonaws.com TLSv1.2 - -
do you know the regex function that would return that date time 03/May/2024:16:04:45 between the first [ and the + ?
@AbdulBalogun Try