SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2008
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with very basic Regular Expression in Dreamweaver

    Hi,

    I'm trying to do a find and replace using Dreamweaver CS4 and am having an issue with what I assume to be a basic Regular Expression.

    In my website I have the following two lines of text used throughout:

    call today on XXXXXX
    call on XXXXXX

    I want to replace the 'XXXXXX' section with a number (e.g. 123) but using the following Regular Expression in the 'Find' box within Dreamweaver I'm only able to find the 'call today on XXXXXX' text...

    Code:
    call (today)? on XXXXXX
    How can I find all sentences that match the above (i.e. 'call today on XXXXXX' and 'call on XXXXXX') but have the word 'today' as optional?

    Also what would I need to add into Dreamweaver's 'Replace' box to change the XXXXXX?

    I assume it would be something like...

    Code:
    call $1 on 123
    Any help appreciated.

    Kind regards,

    M.

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your attempt wouldn't match 'call on XXXXXX', because the pattern has two non-optional spaces between 'call' and 'on'. Try moving one of the spaces inside the parentheses,
    Code:
    call( today)? on XXXXXX
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Wizard silver trophy rushiku's Avatar
    Join Date
    Dec 2003
    Location
    A van down by the river
    Posts
    2,056
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    As you don't care about 'call' or 'call today', match only on 'on ', unless there's conflicting text...

  4. #4
    SitePoint Enthusiast
    Join Date
    Sep 2008
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Thanks AutisticCuckoo that worked!

    Also, in case anyone was interested the replace field was...

    call$1 on 123456

    Thanks for your help.

    M.


Bookmarks

Posting Permissions

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