UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Regular Expression

Forums > Swift

Hello all,

I have no experience with regular expressions. I have an app where I get some JSON from the iTunes API. The descriptions field has some characters that I'd like to get rid of but I'm unsure how to do that: Here is a sample of some text:

Voted America's Best-Loved Novel in PBS's The Great American Read <br /><br /> Harper Lee's Pulitzer Prize-winning masterwork of honor and injustice in the deep South—and the heroism of one man in the face of blind and violent hatred <br /><br /> One of the &#xa0 ;most cherished &#xa0 ;stories of all time

The text highlighted in red, I'd like to replace with a empty string.

How would I write a regular expression to do that?

Thanks, Taz

2      

Don't write a regex for that, just use plain old search and replace.

3      

@roosterboy,

Thanks the the reply, I didn't even think of that. That works perferctly...

Taz

2      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.