Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8816611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:39:36+00:00 2026-06-14T04:39:36+00:00

this text block represents the original external source that is a variable: // the

  • 0

this text block represents the original external source that is a variable:

// the following characters are not-consistent 
text here
// the following characters are consistent
♥ text1
♥ text2
♥ text3
// the following characters are consistent
some more text here

i want to remove everything except for "text here" and i have to do this in ‘parts’ as other text may be present (ie i can’t just remove everything after "text here").

i can remove "some more text here" but am having trouble trying to target and remove the lines beginning with ♥ (or ♥ as they are currently being stored in the database).

so these are my variables

// this is the original external source

$part_one = $external_source; 

// this is the variable that is not working yet

$part_one_a = ;

// this replaces "some more text here" with nothing

$part_one_b = str_replace("some more text here", " ", $part_one);

// this concatenates the variables $part_one_a and $part_one_b

$final = $part_one_a . $part_one_b;

thank you.

update

to be more specific i need a way to remove text such as this:

♥ link_one:  http://link_one_here.com/
♥ link_two:  http://link_two_here.com/
♥ link_three:  http://link_three_here.com/

update two

i’ve managed to remove all unwanted items with str_replace on an array.

the only thing i cannot target and therefore remove is the ♥.

i have tried targeting it with:

  • ♥ (this is the value that is currently being stored in the
    database)
  • ♥ (after i applied a htmlentities to the string)

and no luck – the ♥ is still being displayed. if anyone can tell me how i can target ♥ it would be much appreciated and this question would be resolved.

thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:39:37+00:00Added an answer on June 14, 2026 at 4:39 am

    the solution was:

    1. Do a str_replace on an array to target and remove specific portions of text.
    2. Create a regex and define acceptable values.
    3. Do a preg_replace on non-acceptable values.

    this resulted in all the desired values being shown without instances of non-acceptable characters.

    the code for the last two steps is below:

    // this is the original external source
    
    $part_one = $external_source; 
    
    // create a regex
    
    $regex
    = '~'
    . '['
    . '^'
    . 'A-Z'
    . '0-9'
    . ' '
    . '!_:/,.#$-'
    . ']'
    . '~'
    . 'i'
    ;
    
    // clean the string
    
    $part_one_cleaned = preg_replace($regex, NULL, $part_one);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this block of xaml that allows the text of a hyperlink to
Given variable ${text} , which represents a large block of text such as ...
I know that in HTML4.0 <p> tag is not a block-level element. What about
I have a ViewModel that represents multiple options and implements IDataErrorInfo . This ViewModel
I have a generic class which represents a fragment of text. That fragment of
I'm trying to parse strings that represent source code, something like this: [code lang=html]
I'm trying to do this: <TextBlock Text={Binding Path=Text, Converter={StaticResource stringFormatConverter}, ConverterParameter='\{0}\'} /> But this
I'm trying to do this: <TextBlock Text={Binding Path=Text, Converter={StaticResource stringFormatConverter}, ConverterParameter='&\u2014{0}'} /> To get
Why this works <myToolTip:UserControl1> <TextBlock Text={Binding Path=TestString, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type myToolTip:UserControl1}}}/> </myToolTip:UserControl1> BUT this
Having this text file : Breathing 1:-29.9396 9:-32.0895 13:-35.6787 2:-36.8527 17:-37.3622 8:-38.0584 14:-38.5265 18:-38.7567

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.