Displaying 4 results from an estimated 4 matches for "aerioue".
2024 Mar 01
1
gsub issue with consecutive pattern finds
...x by a character that you know cannot appear (if there is such)
and match it optionally, e.g. with '*" repetition specifier. I used
"?" for the optional character below (which must be escaped).
> gsub("([aeiouAEIOU])\\?*([aeiouAEIOU])", "\\1_\\2", "aerioue")
[1] "a_eri_ou_e"
Cheers,
Bert
On Fri, Mar 1, 2024 at 3:59?AM Iago Gin? V?zquez <iago.gine at sjd.es> wrote:
>
> Hi Iris,
>
> Thank you. Further, very nice solution.
>
> Best,
>
> Iago
>
> On 01/03/2024 12:49, Iris Simmons wrote:
> > Hi I...
2024 Mar 01
1
gsub issue with consecutive pattern finds
...Iago
On 01/03/2024 12:49, Iris Simmons wrote:
> Hi Iago,
>
>
> This is not a bug. It is expected. Patterns may not overlap. However, there
> is a way to get the result you want using perl:
>
> ```R
> gsub("([aeiouAEIOU])(?=[aeiouAEIOU])", "\\1_", "aerioue", perl = TRUE)
> ```
>
> The specific change I made is called a positive lookahead, you can read
> more about it here:
>
> https://www.regular-expressions.info/lookaround.html
>
> It's a way to check for a piece of text without consuming it in the match.
>
> A...
2024 Mar 01
1
gsub issue with consecutive pattern finds
Hi Iago,
This is not a bug. It is expected. Patterns may not overlap. However, there
is a way to get the result you want using perl:
```R
gsub("([aeiouAEIOU])(?=[aeiouAEIOU])", "\\1_", "aerioue", perl = TRUE)
```
The specific change I made is called a positive lookahead, you can read
more about it here:
https://www.regular-expressions.info/lookaround.html
It's a way to check for a piece of text without consuming it in the match.
Also, since you don't care about character...
2024 Mar 01
1
gsub issue with consecutive pattern finds
Hi all,
I tested next command:
gsub("([aeiouAEIOU])([aeiouAEIOU])", "\\1_\\2", "aerioue")
with the following output:
[1] "a_eri_ou_e"
So, there are two consecutive vowels where an underscore is not added.
May it be a bug? Is it expected (bug or not)? Is there any chance to get
what I want (an underscore between each pair of consecutive vowels)?
Thank you!
Best r...