Skip to main content
Nintex Community Menu Bar
Solved

NWC - import CSV and split lines using RegEx

  • February 28, 2023
  • 3 replies
  • 206 views

Forum|alt.badge.img+2

Working in a tenancy with very strict limitations, no Power Automate etc. so NWC is the only go-to.

I’m importing a CSV from SharePoint, and are trying to split the rows out to a collection using RegEx.

I’m validating using online tools to check the expressions - and while they work, both the Nintex nwc-tools regex test and the workflow fail the expressions.

https://regex101.com/

https://www.regextester.com/

and because one forum post suggested NWC used Ruby https://rubular.com/

Example of file rows

AB-CD-02-S.docx,Document Approver,abc\conman
PQ-RS-01-T.docx,Document Approver,abc\robber
WX-YZ-02-V.docx,Document Reviewer,abc\conman
 

Example of expressions which work in other portals

    (^[^abc\\][^\r\n]+)$

    (^[^c\\S][^\r\n]+)$

    ([^\r\n]+)$

These fail in Apply a regular expression | Platform Tools (nintex.com) with 

    "Error": { 

    "Code": "INTERNAL.ERROR",

    "Message": "Bad JSON escape sequence: \\c. Path 'input', line 2, position 51.",

which is \c in the first line.

 

Appreciate it if someone’s run into similar and has a workaround.

TIA
Rob

Best answer by bsikes

Unfortunately, using the testing tool isn’t always a great test. NAC does alot of weird formatting stuff behind the scenes when it comes to escaping characters, and it seems that this is a situation where it handles it for you. The error you’re getting is referring to the “\c” in “abc\conman”, and I don’t get that when I actually use it in a workflow.  I used this regular expression: ([^\r\n]+)(\r|\n)*

 

 

3 replies

Forum|alt.badge.img+11
  • Contributor
  • Answer
  • February 28, 2023

Unfortunately, using the testing tool isn’t always a great test. NAC does alot of weird formatting stuff behind the scenes when it comes to escaping characters, and it seems that this is a situation where it handles it for you. The error you’re getting is referring to the “\c” in “abc\conman”, and I don’t get that when I actually use it in a workflow.  I used this regular expression: ([^\r\n]+)(\r|\n)*

 

 


Forum|alt.badge.img+2
  • Author
  • Rookie
  • March 1, 2023

Thank you, that’s a big step forward

Funny how 2 people can do the same thing, and get differrent results

 


Forum|alt.badge.img+11
  • Contributor
  • March 1, 2023

It looks like you’re using the Split operation instead of the Extract operation. I’d try switching that and see if it fixes your issue.