How to replace the symbol "%" with the word "Percentage".
My original line is: "Internal (%) External (%)". The string should be "Internal (percent) external (percent)"
Using regex, how can I replace this character?
Thanks in advance. Atul
Here you do not need Regex, you can use the usual replacement. For example, using .net:
string s = "Internal (%) External (%)"; s = s.Replace("%", "Percent");
the match string will be just a percent symbol:%
However, the implementation is specific to your regex environment.
Javascript
var myString = "Internal (%) External (%)"; myString = myString.replace(/%/g,"Percent");
? , , Python...:
>>> "Internal (%) External (%)".replace('%','Percent') 'Internal (Percent) External (Percent)'
RE - , :
>>> import re >>> re.sub('%', 'Percent', "Internal (%) External (%)") 'Internal (Percent) External (Percent)'
, RE , , , , ! -)
Java %, .
myString = myString.replaceAll("%", "Percent");
, , % HTML
myString = myString.replaceAll("%", "%");
Source: https://habr.com/ru/post/1744659/More articles:dropdownlist hierachy parameter filter - jqueryLucene: The fastest way to return phrase documentation? - pythonIs there any class in the .NET Framework to represent a container for storing objects? - multithreadingHow to incorporate sound into a Javascript-based website without resorting to Flash programming? - jqueryXUL: how to visualize special html objects (copy, trade, hail ...)? - htmlWhat is the best multi-threaded application debugger for C ++ applications - c ++Как подключить большую информацию к файлу JPEG? - jpegFatsest способ редактировать альфа CGImage (или UIImage) прикосновением, а затем отображать? - iphoneWhat is the best choice for developing real-time form validation in ASP.NET - javascriptFacebook Canvas Apps, the new API - javascriptAll Articles