Clean-up a long string contents ... - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Clean-up a long string contents ...

shamilsonsshamilsons Posts: 1Member
Hello everyone,
I tried to clean-up some html tags(i.e. , , image, etc) and just leave Expresions expressions for the given string below.

[code]
ISSN:
1097-6353Title:A-E-C SystemsAdditional Title InformationAdditional Title Information
[/code]

I tried several way with regular expressions but could not succeed.
Any help will be apperciated ...
thank you.


Comments

  • acetechcnacetechcn Posts: 28Member
    This post has been deleted.
  • CJNimesCJNimes Posts: 13Member
    Maybe this works:

    $search = "%(<[A-Za-z]+)(.*?)(>)%is";
    $replace = "\1\3";
    $newString = preg_replace($search,$replace, $oldString);
  • nuonuo Posts: 1Member
    Why not just use the strip_tags function?

    [code]
    $oldString ='ISSN:1097-6353';

    $newString = strip_tags($oldString, '');

    echo $oldString . "
    ";
    echo $newString;
    [/code]



  • CJNimesCJNimes Posts: 13Member
    I think he wants to clean styles also and strip_tags don't work for that.

    If you have something like "hello" with strip_tags will result "hello" and I guess he wants to get "hello".
Sign In or Register to comment.