Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My text in the box:
HTML
[B][U][I]Hello World![/B][/U][/I]


Can you tell me how to read the text and show the result like: Hello World! after clicking "submit" button?

I mean that: I will store the text in my string field (
C#
public string mystring {get; set;}
)

The value of mystring after submit:

C#
mystring = "[B][U][I]Hello World![/B][/U][/I]";


How to filter it?
Thanks!
Posted
Updated 30-Apr-15 1:35am
v3
Comments
F-ES Sitecore 30-Apr-15 8:22am    
Use Regex to replace [b] with <b> and so on, google for regex replace examples and you'll probably find something relevant. You could use a standard string.Replace but you have to deal with the case where there are opening tags but no closing tags, so you really want to replace

[b]***anthing***[/b]

with

<b>****anything</b>

such that this

[b]***anthing***

remains as it is untouched, and you really need regex for that.

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