Hi,
Which RegEx experssion can I use to check each row in Excel file to find row that does not match the pattern: “Name Surname” and fix it as in attached pciture:
Hi,
Which RegEx experssion can I use to check each row in Excel file to find row that does not match the pattern: “Name Surname” and fix it as in attached pciture:
Hello
I might have a solution for you…
Please provide a full sample (de-identified)?
I am assuming they have a capital letter at the start and lowercase for the remaining?
To add a space between, try this pattern:
(?<=[a-z])(?=[A-Z])
THen insert a " "
Regex101.com
You will also need to add an IF condition to handle when there is no match.
To remove spaces, you could try this pattern:
^\s*
Then replace with - “”
Regex101 link
You can directly Trim the Cell Value before any other operators.
Thank you for your responce. Do you mean like this?
Hello @Apple1,
No use Matches Activity and pass the above pattern
Hello
To insert a space:
Try this in an Assign activity:
System.Text.RegularExpressions.Regex.Replace(INSERTYOURVARIABLE, “(?<=[a-z])(?=[A-Z])”, “ ”)
To clear the excessive spaces:
Try this in an Assign activity:
System.Text.RegularExpressions.Regex.Replace(INSERTYOURVARIABLE, “^\s*”, “”)
For more information about Regex - check out my Regex MegaPost which has a working demo you can download - (no replace activities though).
Hi @Apple1
Below is the solution which will solve your query :-
Regex.Replace(row(0).ToString.Trim,"\s+"," ").Split(" "c)(0)+" "+Regex.Replace(row(0).ToString.Trim,"\s+"," ").Split(" "c)(1)
Just the below double quotes space you have to add :-
Below is the workflow for the same :-
Pratik.xaml (9.7 KB)
Apple.xlsx (8.3 KB)
Mark as solution and like it if this helps you
Happy Automation
Best Regards
Er Pratik Wavhal
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.