I have a string variable that I want to split into a string array using the regex. The problem is the whole string is together and there are no separators.
I want to insert separators so that I can later split the strings into an array. How should I proceed?
I want to insert a separator between each “text(nr)” and thus split the string into an array afterwards with string.split.
I’ve tried to split it with regex.split. It does split but it adds 3 empty strings to the array.
Used command: arraystring = regex.split(stringinput, “\w{4}\d{1}”)
I’ve also checked the variable type, but it’s set correctly.
Thanks @Steven_McKeering! My solution was just to put any regular expression in a positive lookahead and use it with Regex.Split() and Skip(). Since @Keemper already made a correct regular expression (for the sample text), I’m sure he/she can adjust it to include words and digits of variable length.
Update: It turns out that it was not that easy to use variable length with positive lookahead. So Yoichi’s solution is the best solution so far.
Hi. I’m new here.
Could someone help me with my problem?
the input i have: Qianhong Zhang; Ouyang Miao; Fubiao Lin; Zhongni Zhang
the output i want: Zhang, Qianhong; Miao, Ouyang; Lin, Fubiao; Zhang, Zhongni
this is how i change the order (for only 1 name):
(.?)\s([\wáâàãçéêíóôõúüÁÂÀÃÇÉÊÍÓÔÕÚÜ]+-?'?\w+.?$)
\w'?\w+.?$/gmi - LASTNAME
\w'?\w+.?$/gmi - LASTNAME
(.?)([\wü]+-?'?\w+.?$)/gmi - FIRST AND LASTNAME
(.?)([\wáâàãçéêíóôõúüÁÂÀÃÇÉÊÍÓÔÕÚÜ]+-?'?\w+.?$)/gmi - FIRST AND LASTNAME
My question: how do i get the output i want with the input i have? how do i add the (; ) between the Names?
There’s no generator for Regex.Split but the substitution feature in regex101 might help you to see the result of a split if you insert the replacement value “\n”.