www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > Perl

    Perl Discussion and technical support for using and deploying Perl.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 01-04-2007, 02:13 PM
    st33d st33d is offline
    Registered User
     
    Join Date: Dec 2006
    Posts: 26
    Find and replace first non tag

    I'm having trouble getting my head round this one. I want to search a html node which I've already extracted and substitute the first non tag.

    s/(1st non tag)/(1st non tag + $string)/i

    I'd image the script for the match would be along the lines of

    >\w+<

    But I can't figure out how I would get the actual pattern matched. Is there a way to do this?
    Reply With Quote
      #2  
    Old 01-06-2007, 11:43 AM
    st33d st33d is offline
    Registered User
     
    Join Date: Dec 2006
    Posts: 26
    Huzzah!

    # Make the first line bold
    $body =~ s/>(\s*([^><\s]+\s*)+)</><b>$1<\/b></;

    Last edited by st33d; 01-06-2007 at 08:39 PM. Reason: regex wrong - only changed single words
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 04:36 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.