Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I need a RegEx to replace all occurrences of "l" by "ł" in string. Replacement should happen only if:

1)there is "z" before "l",

AND

2)there should be a number or "." after "l"

For ex:
1)If string is "abc zl12,200", output should be "abc zł12,200"
2)If string is "zl.00", output should be "zł.00"
3)If string is "adbc zlopr", output should be "adbc zlopr"

Thanks!
Posted

It makes no sense to use Regex for such a simple thing. string.Replace will do it just fine: https://msdn.microsoft.com/en-us/library/czx8s9ts%28v=vs.110%29.aspx[^].

As to Regular Expressions… just learn them — will be useful. What's the problem? :-)

—SA
 
Share this answer
 
Comments
Andreas Gieriet 3-Feb-16 4:50am    
My 5, Sergey.
Cheers
Andi
Sergey Alexandrovich Kryukov 3-Feb-16 9:31am    
Thank you, Andi.
—SA
Try This
string str = "abc zl12,200";
str = str.Replace('l', 'ł');
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900