Hi Guys

I am really green when it comes to regex , I have never had to use it much but here goes, I want to be able to remove html tags from a string so I am only left with the content.

i am using

String.replaceAll("<(.|\n)*?>","");

This doesnt seem to be working any ideas on how I can make this work.

Look forward to hearing from you


Steve

you have:

String.replaceAll("<(.|\n)*?>","");

Not sure why you are using String here in the static sense.

If i had

String mystring = readFile();

// now string is populated.
// proper use of replaceall below
mystring=mystring.replaceAll("<(.|\n)*?>","");

see you want to call mystring.replaceAll , so it knows which string its operating on, and it returns a string so you want mystring=mystring.relaceAll(args...);

Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.