Find and Replace help
Hi people,
First time on here....
Have a little problem...
I want to use the regular expression functionality in the
find and replace dialog. I want to replace each "; " with
";{carriage return}"
tried using
lookfor: ;
replace ;\r
\n, 0x09, and all sorts...
could someone give me some pointers please?
much appreciated.
On Tue, 18 Apr 2006 15:38:09 +0000 (UTC), "ToonMariner"
<[email protected]> wrote:
> I want to use the regular expression functionality in
the find and replace
>dialog. I want to replace each "; " with ";{carriage
return}"
Find: ;
Replace with: ;\n
works for me.
Gary
Similar Messages
-
Find and replace help needed, multiple variables
Hi everyone,
Im trying to find all urls in my code that start in a particular way but have a number variable at the end, see examples below
<a href="/example/examplefolder/enquiry.asp?pid=123">
<a href="/example/examplefolder/enquiry.asp?pid=485">
<a href="/example/examplefolder/enquiry.asp?pid=284">
and replace them with one url, see example below
<a href="/example/examplefolder/default.asp">
How can I use Dreamweaver find and replace to achieve this across my whole website?
So far I only know how to find one thing and replace with another, rather than finding variables and replacing them with one thing.
Thanks for your help with this!In the Find field of the Find and Replace dialog box, enter this:
(href\s*=\s*\"\/example\/examplefolder\/enquiry\.asp)\?pid=\d+(\")
In the Replace field, enter this:
$1$2
Select the "Use regular expression" checkbox.
Explanation:
The two sets of parentheses are capturing groups, which capture the actual values as $1 and $2.
The \s* matches zero or more spaces.
\" matches a double quote.
\/ matches a forward slash.
\? matches a question mark
\d+ matches one or more numbers.
I have written a two-part tutorial on using regular expressions, which can be found here: http://www.adobe.com/devnet/dreamweaver/articles/regular_expressions_pt1.html.
Message was edited by: David_Powers (adding explanation of double quote). -
Find and replace help needed deleting multiple Word bookmarks
I'm importing sections of a Word document. The Word documents have bookmarks such as:
<h3><a name="_Toc226886762" id="_Toc226886762">Fixed-variable</a></h3>
I would like to do a sitewide search and replace, deleting all the bookmarks (they all start with Toc) but keeping the heading format and the text. I've tried various options, but nothing is working.
Thanks.I just tried it again. When I clicked Replace All, the dialogue box disappeared. When I opened it again, I found a small square box at the end of the search string. When I tried to copy and paste it to here, it didn't show up. <a name="_Toc[^>]+>([^<]+)</a>
When I was searching and getting no results, I had copied and pasted a section with only one bookmark in it. It was in the child of a template, but I can't see how that would make a difference.
Here's the code:
<div id="mainContent">
<h2><a name="_Toc227356382" id="_Toc227356382">Combine trips</a></h2>
<p>Unless you live across the street from the grocery store, consolidating shopping trips will save you time, gas, and reduce emissions. Unless it’s a staple on sale, don’t buy what’s not on your list. </p>
<p><em>Costco sells gasoline for less than the local stations. We wait until the tank is close to empty and the let the savings on gas pay for the trip.</em></p>
<h2><a name="_Toc227356383" id="_Toc227356383">Compare prices</a></h2>
<p>Keep a small spiral notebook with prices of items you purchase regularly such as rice, pasta, and dog food. A credit card size calculator makes comparing prices easier.</p>
<h2><a name="_Toc227356384" id="_Toc227356384">Check the receipt</a></h2>
<p>Computers don’t make mistakes, but operators do. If sales prices aren’t entered into the system, the scanned price will reflect the regular price. Some stores will give you the item for free if the scanned price exceeds the price on the shelf. </p>
<h2><a name="_Toc227356385" id="_Toc227356385">Price matching</a></h2>
<p>Some stores match competitors’ sales prices. Look for a sign that says “Guaranteed low prices” and show them the ad. That can save you both time and gas. Some promise to beat prices by 10%, so you can save money as well. </p>
<p>Many big box retailers demand exclusive manufacturer’s numbers so they can evade making good on price matching guarantees. The product may have a meaningless difference, such as the color of the icons. </p>
<h3> </h3>
<p> </p>
<!-- end #mainContent -->
</div> -
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/ -
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
LanceThanks 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
> -
Need Help With find and Replace
I am a little green to this all. I am trying to find and
replace a word inside the edit region and Dreamweaver will not
change it, because it says its inside a locked region, but its a
editable region?
I have about 900 pages I need to make this change on and was
relying on the find and replace tool to do that. I tried differn't
advanced options, nothing seams to change it. I am using cs3.
Thanks for any helpUsing Templates with a 900 page site is a crime against
humanity. You reach
the optimal size for Templates between about 50 and 100.
The error you are getting suggests that there are coding
errors on the page
(perhaps even unrelated to ANY DW Template markup). We'd need
to see the
page to make progress with what that might be, as Alan says.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"RyanWaters" <[email protected]> wrote in
message
news:ggs7fq$gnq$[email protected]..
>I am a little green to this all. I am trying to find and
replace a word
>inside
> the edit region and Dreamweaver will not change it,
because it says its
> inside
> a locked region, but its a editable region?
> I have about 900 pages I need to make this change on and
was relying on
> the
> find and replace tool to do that. I tried differn't
advanced options,
> nothing
> seams to change it. I am using cs3. Thanks for any help
> -
Help with removing a variable number using "find and replace"
Hey, I have to remove a variable number from a large number of documents.
How would I do this using "find and replace"
<text><![CDATA[Coloured 250]]></text>
250 is an example of the variable number that I will need to remove so it looks like this:
<text><![CDATA[Coloured]]></text>
Note: the text "coloured" is subject to change also.
ThanksThat's a possibilitly I'll explore. Thanks for the alternate perspective!
(5 minutes later)
Oh well, it was a good thought.
Unfortunately each line of raw original text may contain from 1 to 4 lines of final text. In other words there is no consistency in the number of backslashes (hard returns) in each line of original text, and thus, when backslashes are converted to commas, no consistency in the number of data elements in each data set.
Sadly PS variables will not handle finding a source text line that does not have data for 4 variables. So I either have to go back and add enough commas on each short line to make four individual data elements for each data set... or I simply deal with the hard returns within Photoshop.
I think I've reached the limit of automation on this process. -
Find and replace advanced help
Firstly thank you for reading. I come here as a last resort to see if there's a solution to a problem I have.
Basically I need to rename several thousand images in a blog backup that is being transfered to a new host. The format of the images are as follow
<img alt="Revlon-pedi-egg" border="0" src="images/6a00d8341c873353ef011572419566970b-800wi.jpg" />
where each of the several thousand images has a unique alt tag and a unique image name
What I want dreamweaver to find the alt tag then replace the image name, so that the above image would become
<img alt="Revlon-pedi-egg" border="0" src="images/Revlon-pedi-egg..jpg" />
I have used replace expressions before as well as (.*) etc but I just can't seem to get this one to work.
Is this possible and if so would someone be kind enough to give me some pointers?FIRST MAKE A BACKUP.
Test this in several pages first.
In Dreamweaver Find and Replace, select the following options:
Find in: Current Document
Search: Source Code
Find:
<img alt="([^"]+)(".*?)src="images\/[^.]+
Replace:
<img alt="$1$2src="images/$1
Select Use regular expression.
Once you are confident that it's making the correct changes, you can then do it for an entire folder or the whole of the current site.
This assumes that all your image tags use double quotes around attribute values as shown in your original post. -
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,
WillianI 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 -
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. -
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
Green4everHi 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 -
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) -
How do I include a line feed in the replace section of the
find and replace feature of Homesite 5.5?
Converting many lengthy files from <pre> and <tt>
formats into CSS. Presently the target pages have paragraphs broken
into short lines of text with CR/LF's on every line. I wish to
revert the paragraph back to 'wrapped' text with a single CR at the
end of the paragraph.
I can 'find' and eliminate the " ¶ " symbol from each
line, but I do not know how to "replace " text that should include
this symbol.
text</p><p>¶
This is some sample text to¶
show graphically the problem¶
I am having.</p><p>¶
New Paragraph¶
When what I want is :-
<p>This is some sample text to show graphically , the
problem I am having.</p>¶
<p>New paragraph
Presently I can add hash marks (##) where I wish the
paragraph to end. I then globally remove all the "¶"'symbols
that appear in the text. What I want to do now is replace the ##
with code which would produce the following two lines
</p>¶
<p>
I have tried many different codes, such as chr(13) and \r,
but they all just insert the code as straight text.
Can anyone clue me in?
Thanks, gil das far as special chars in simple F-and-R, I replace some
non-ascii chars by copying from a doc and pasting into the dialog
field.
That wouldn't work for CR/LF, so you have to use the extended
search and replace there as you found out.
Note there is also a function for "Replace Double Spacing
with Single Spacing" (on the menu, under Search).
Probably no help for this case, but good to know.
BTW, be careful with your extended search and replace on
CR/LF. If your lines don't end in a space and a CR/LF, you might
want to replace CR/LFs with a space. Otherwise the last word of one
line might be butted against the first word in the next line with
no space when the CR/LF is removed.
Of course that's not a great solution since it adds a lot of
spaces where you have CR/LFs, and you may not want them all
there...
There is a Remove Returns script that might be of use to you.
It's a lot more manual than you probably want for doing lots of
files.
http://www.wilk4.com/asp4hs/list5.htm#removereturns
let us know here if you find some better solution please,
good luck,
jeff -
Batch Edit Multiple HTML files | Find and Replace
Hi,
I would like to use Automator to automate (I know that sounds redundant) the following process.
1. Take a group of html files
2. Open each file so it can find and replace the script of any image folders
Example:
Change: img src="home_files/photo.jpg" to img src="images/photo.jpg"
3. Save & Close each file
I assume this this would have to be done in either AppleScript or Cocoa.
Any help would be greatly appreciated.
Thanks in advance.you most definitely don't need Cocoa for something like that. if all you need is a straightforward search and replace in a bunch of html files you can easily do this with a shell script. If you need some more involved search and replace you have to explain what it is exactly that you want.
to automate direct search and replace you can do something along the following lines in automator
1. get selected finder items (this will select your html files)
2. run shell script action with input passed as arguments
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
for f in "$@"
do
fl=`echo "$f"`
sed 's%home_files/photo.jpg%images/photo.jpg%g' $f > /users/$USER/.tmp.txt
cat /users/$USER/.tmp.txt > "$fl"
done
rm /users/$USER/.tmp.txt</pre> -
Windows PowerShell is a powerful command tool and we can use it for management and operations. In this article we introduce the detailed steps to use Windows PowerShell to find and replace test string in the
shapes in Excel Object.
Since the Excel.Application
is available for representing the entire Microsoft Excel application, we can invoke the relevant Properties and Methods to help us to
interact with Excel document.
The figure below is an excel file:
Figure 1.
You can use the PowerShell script below to list the text in the shapes and replace the text string to “text”:
$text = “text1”,”text2”,”text3”,”text3”
$Excel
= New-Object -ComObject Excel.Application
$Excel.visible = $true
$Workbook
= $Excel.workbooks.open("d:\shape.xlsx")
#Open the excel file
$Worksheet
= $Workbook.Worksheets.Item("shapes")
#Open the worksheet named "shapes"
$shape = $Worksheet.Shapes
# Get all the shapes
$i=0
# This number is used to replace the text in sequence as the variable “$text”
Foreach ($sh in $shape){
$sh.TextFrame.Characters().text
# Get the textbox in the shape
$sh.TextFrame.Characters().text =
$text[$i++]
#Change the value of the textbox in the shape one by one
$WorkBook.Save()
#Save workbook in excel
$WorkBook.Close()
#Close workbook in excel
[void]$excel.quit()
#Quit Excel
Before invoking the methods and properties, we can use the cmdlet “Get-Member” to list the available methods.
Besides, we can also find the documents about these methods and properties in MSDN:
Workbook.Worksheets Property (Excel):
http://msdn.microsoft.com/en-us/library/office/ff835542(v=office.15).aspx
Worksheet.Shapes Property:
http://msdn.microsoft.com/en-us/library/office/ff821817(v=office.15).aspx
Shape.TextFrame Property:
http://msdn.microsoft.com/en-us/library/office/ff839162(v=office.15).aspx
TextFrame.Characters Method (Excel):
http://msdn.microsoft.com/en-us/library/office/ff195027(v=office.15).aspx
Characters.Text Property (Excel):
http://msdn.microsoft.com/en-us/library/office/ff838596(v=office.15).aspx
After running the script above, we can see the changes in the figure below:
Figure 2.
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.Thank you for the information, but does this thread really need to be stuck to the top of the forum?
If there must be a sticky, I'd rather see a link to a page on the wiki that has links to all of these ForumFAQ posts.
EDIT: I see this is no longer stuck to the top of the forum, thank you.
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing)
Maybe you are looking for
-
Help with drawing strings on JFrame?!?!
Hey guys, I'm really new to Java (just started AP Comp Sci last month), and we had a project to build a Mastermind application using numbers, which I did. However, I'm trying to learn more on my own, and was hoping to use the example code my teacher
-
Urgent:: regarding purchase order group address
hi all. i need to know in which table can i find the Purchase Order Group address details... waiting for ur reply asap.. thank u.
-
Hi All, i have a SharePoint list, that list contains photos(images). now i want display that images in spgridview. How can i display? Thanks in advance!
-
Code Inspector Issue - "MODIFY - without TRANSPORTING was found in line "
Hi all I am new to abap and my transports are unable to move further because of code inspector error "MODIFY - without TRANSPORTING was found in line ". Help me resolve the issue. For example LOOP AT i_user_add. i_user_add-mandt = sy-mandt.
-
Datacontrol complex return type binding to a table
Hello guys can you please give a hand here? Here is the scenario: The return object of the method getAvailableConfigurations return a complex type AvailableConfigurationsDto and inside that object I need to access configuration Object that has the fo