Help in Regex
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello All,
I have a dataset where rows are like -
os="Windows";osArch="amd64";version="10+19042" ;processorCount="2";Frequency="1.2";physicalMemory="3863MB";CPUModel="Intel (R) Core(TM) i3-1005G1 CPU @ 1.20GHz;b1;ci:2;4;1.2||os:1-;0;19042;1||";GPUModel="Intel(R) UHD Graphics;27.20.100.9365;8086.8a56.9791028.7;";format="new";win_64_client="4";sys_lang="es-PE";client_lang="rn"
I wanted to fetch the value in quotes from - win_64_client="4"
When I'm using Regex Parse -- .+\w{3}\d+_\w+=.+(\d+).+ I'm getting the expected result in new column.
In formula tool it's also working in Alteryx -- REGEX_REPLACE([DEVICE_INFO], ".+\w{3}\d+_\w+=.+(\d+).+", "$1")
When I'm applying the same formula while connecting the data from Snowflake database, I'm getting Null values.
select db_userid, device_info,
regexp_substr(device_info, '.+\w{3}\d+_\w+=.+(\d+).+') as "RESULT"
from ZOOM_DATA_GO.DYNAMODB.LOG_ATTENDEE
where device_info like "%win64_client%"
limit 10;
Please correct me with the correct syntax where is my mistake.
- Labels:
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
1) your alteryx regex is wrong. you need \w{3}_\d - without the _ your regex would not work in alteryx with the provided input.
2) Snowflake uses POSIX regex. Alteryx uses PERL regex.
3) try something like: select
regexp_substr('os="Windows";osArch="amd64";version="10+19042" ;processorCount="2";Frequency="1.2";physicalMemory="3863MB";CPUModel="Intel (R) Core(TM) i3-1005G1 CPU @ 1.20GHz;b1;ci:2;4;1.2||os:1-;0;19042;1||";GPUModel="Intel(R) UHD Graphics;27.20.100.9365;8086.8a56.9791028.7;";format="new";win_64_client="4";sys_lang="es-PE";client_lang="rn"', '\\w{3}_\\d+_\\w+.+"\\d+"',1) as "RESULT";
to extract the win_64_client part... do you need more - what about:
4) select
regexp_replace(regexp_substr(regexp_substr('os="Windows";osArch="amd64";version="10+19042" ;processorCount="2";Frequency="1.2";physicalMemory="3863MB";CPUModel="Intel (R) Core(TM) i3-1005G1 CPU @ 1.20GHz;b1;ci:2;4;1.2||os:1-;0;19042;1||";GPUModel="Intel(R) UHD Graphics;27.20.100.9365;8086.8a56.9791028.7;";format="new";win_64_client="4";sys_lang="es-PE";client_lang="rn"', '\\w{3}_\\d+_\\w+.+"\\d+"',1),'"\\d+"'),'"','') as "RESULT";
