Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation extract text BETWEEN

    hello guys I want to extract text between

    Code:
    <span style="color: red;">Your Price</span>:$
    and
    Code:
    <br>
    and show the extracted text

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    620
    Thanks
    1
    Thanked 20 Times in 20 Posts
    Code:
    InPut='<span style="color: red;">Your Price</span>:$123456<br>';
    OutPut=InPut.replace(/^\<span style\="color: red;"\>Your Price\<\/span>:\$(.*)\<br\>$/,'$1');
    alert(OutPut);

  • #3
    New Coder
    Join Date
    Apr 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jalarie View Post
    Code:
    InPut='<span style="color: red;">Your Price</span>:$123456<br>';
    OutPut=InPut.replace(/^\<span style\="color: red;"\>Your Price\<\/span>:\$(.*)\<br\>$/,'$1');
    alert(OutPut);
    the price is always changing

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    620
    Thanks
    1
    Thanked 20 Times in 20 Posts
    I posted an example of the critical piece. You have to pick up the string in question and place it into the InPut variable, run that second line, and then do something with the OutPut variable. Only the second line actually applies to your question.

  • #5
    New Coder
    Join Date
    Jun 2012
    Posts
    80
    Thanks
    0
    Thanked 18 Times in 18 Posts
    Code:
    <span style="color: red;">Your Price</span>:$
    wanted value
    <br>
    Why you have to bother about "Price" since you only want ?
    Just focus on what you want

    Code:
    </span>:$
    wanted value
    <br>


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •