Jump to content
Sign in to follow this  
John117

Help with StringRegExpReplace

Recommended Posts

John117

The If sections shows that I would only like to replace the word if the 4th character from the end is not a vowel. How can I do this? I would like to get rid of the "if" section completely and just use StringRegExpReplace.

$sStr = "Spies Fries"

$sStr = StringRegExpReplace($sStr, "(?i)\b([a-z]+)ies\b", "$1y")

If StringLeft(StringRight($sStr, 4), 1) <> "a" and StringLeft(StringRight($sStr, 4), 1) <> "e" and _
StringLeft(StringRight($sStr, 4), 1) <> "i" and StringLeft(StringRight($sStr, 4), 1) <> "o" and _
StringLeft(StringRight($sStr, 4), 1) <> "u" and StringRight($sStr, 3) = "ies" Then $sStr = StringLeft($sStr, StringLen($sStr) - 3) & "y"
    
Consolewrite($sStr)
Edited by John117

Share this post


Link to post
Share on other sites
Authenticity

You mean this?

$sStr = "Spies Fries"

ConsoleWrite(StringRegExpReplace($sStr, '(?i)(?<=\w)([^aeiou\W])ies\b', '\1y') & @LF)

Edit: Added \W to not match things like "s ies" or "oh@ies" lol ;]. Forgot \b also.

Edited by Authenticity

Share this post


Link to post
Share on other sites
John117

You mean this?

$sStr = "Spies Fries"

ConsoleWrite(StringRegExpReplace($sStr, '(?i)(?<=\w)([^aeiou\W])ies\b', '\1y') & @LF)oÝ÷ Ù±ßÛ×^wOvZÚ'¢ÙµÈm)à²X¤z«¨¶È²«¨¶êºh'¬ªê-E¢¸(·Ovm©l£ú®¢×¢ºò-(§µêçz×(*'§m¢«v·¬zÛazº.µêÚÚÞvazÇ­º³}Ó«b±ìZrÙr­#¬$x¢½÷JêÞmæ­±«­¢+ØÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥¡¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅ¡äÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥©¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅ©äÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥­¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅ­äÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥±¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìűäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥µ¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìŵäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥¹¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìŹäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥Á¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅÁäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥Å¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅÅäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥É¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅÉäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥Í¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅÍäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥Ñ¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅÑäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥Ù¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅÙäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥Ý¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅÝäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥á¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅáäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥å¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅåäÅÕ½Ðì¤(ÀÌØíÍMÑÈôMÑÉ¥¹IáÁIÁ± ÀÌØíÍMÑÈ°ÅÕ½Ðì ý¤¤ÀäÈí¡mµét¬¥é¥ÌÀäÈíÅÕ½Ðì°ÅÕ½ÐìÀÌØìÅéäÅÕ½Ðì¤

;-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×