Coda 2 - RegEx - Search and Replace Issues - coda

I'm trying to search and replace links in over 400 HTML pages. Pretty much I need to change:
Search: domain-name[dot]org/learning/bridge.php?sl=70
Replace:
Replace: seconddomainname[dot]com/Water/70.htm
Pretty much search for link1 and replace using link2 but keeping the number from link1. The regular expression (link included below) worked but when I apply it to Coda 2, it doesn't work.
enter image description here

Is actually quite simple. You don't need to escape anything in your search string aside for the question mark and period.
Your search is:
http://domain-name\.org/learning/bridge\.php\?sl=([\d]+)
and your replace is:
http://new-domain/water/\1.htm

Related

search for pattern in text using wildcards and automatically export the matches

I've been trying to use Thunderbird with expression search and ImportExportTools Add-on to look for a specific pattern in my emails, which worked to some degree at least. But now I'm unable to create a rule which would export the matches (and not any text before and after the pattern I searched for). I also tried using Libreoffice Calc but it's taking much longer to search and freezes doing so plus it also marks the whole line in which the pattern I searched for is found. I'd be really glad if anyone could help me out by suggesting a way to achieve my goal!
Expresso by Ultrapico Editor regex search does the trick

Azure Search result highlight snippets

I am using the Hit Highlighting feature in Azure Search and noticed a discrepancy in the way it behaves from the documentation. In the documentation it says that when you use hit highlighting it will return a snippet of the field with the highlight, but it always returns the entire field (with proper highlighting).
Is there a way to have Azure Search instead return just a snippet (say of about 200 characters) that includes the highlight?
Currently, the answer is no, you cannot. The field breaks according to (English) sentence rules, ie. it breaks on ".", "!", "?".
Also see this question for an example on breaking and some more info relating to the delimiters.
Depending on the nature of the field you might be able to add one of the above delimiters to 'emulate' what you want to accomplish (as suggested by Nate Ko).
I want to suggest something else on top of what Nate spoke to. When you look at the document response, also take a look at the Highlights part of the results (as opposed to the Document). For example, you might be currently getting the field results by retrieving something like this:
Results[i].Document.DESCRIPTION
If there is a highlight found for that field, the snipped will be found here:
Results[i].Highlights.DESCRIPTION
What I like to do is to first check if there is a valid Highlight and if so display it. If not, I show the actual field content.
Liam
We recently introduced a change that improves the highlighter performance on large fields and NLP experience. One side effect of the change was that the new highlighter generates snippets based on sentences, breaking the text field on '.' (period).
One way to workaround the issue is to put '.'s in the field. We are working to enforce the snippet size and let you know when it is available.

VIM Convert Text to URL with Search/Replace

I have a document that contains long filenames, followed by a hyphen, followed by a description of the contents of the file. The files are all PDFs. I am converting this document into a page on our website, so that it has the filename, which should be a link to the file, followed by the description of the file contents.
I'm fairly versed in the basics of VIM, but advanced search/replace is something I'm lacking in. What I'd like to do is convert each filename into a link to that filename. For example:
WebAdapt_Prod_Int_10.1_Install.IIS7.2008R2.pdf - Step by step instructions for installing ArcSDE 10.1 for Oracle on the ‘Test’ environment, including configuration notes.
Should convert to:
WebAdapt_Prod_Int_10.1_Install.IIS7.2008R2.pdf - Step by step instructions for installing ArcSDE 10.1 for Oracle on the ‘Test’ environment, including configuration notes.
There are roughly 30 of these documents, so going line-by-line would be time consuming (though by the time I get a response I'll probably already have done it). I'd just like to know how to do this for the next time I'm given a big text file that needs formatting.
Thanks in advance!
Try this:
:%s!\v^\S+\.pdf!&!
Please note that the above doesn't try to do anything with HTML entities though. See the Vim Tips wiki for a possible solution if that's a concern.
Edit: The way this works:
:% - filter the entire file
s!...!...! - substitute
\v - set "very magic" syntax for regexps
^\S+\.pdf - match one or more non-spaces at the begging of line, followed by .pdf
& - replace with the link: & is the matched string (that is, the filename).

Misspelled, wierd split words search in XSLT & Umbraco

Is it possible in XSLT to search and find content, even though the content is misspelled or the words splitted up - even though it shouldn’t?
Example:
I need to find a webshop called bearshop.com, but I search it like this “bear shop”. This will end in a “no results”.
Another example:
I search “progresive” but the right word was “progressive”, and this will end in a “no result” as well.
The most important part is the first example, where the search can be written with or without white spaces and still find the content. Hope someone can help me or lead me in the right direction :)
Kind regards,
Niels
If you are looking for a general way of matching similar words, this is often called fuzzy search and can quite easily be done with Umbraco and Examine.
There may even is a way to use this with XSLT, though I never tested that.
Assuming XSLT/XPath 2.0 you can use //foo[matches(., 'bear\s*shop')].

How to replace/remove specific strings from html file using Notepad++?

I've export my bookmarks from FF in to a html file but it's too huge and complicated, so I need to remove some firefox lines from it to make it more lighter and plain.
I can replace basic things in the Notepad++ but I guess I do need some operators for this and I have no idea how to make it work right.
For example here is the line from the file containing a link to Logodesignlove :
Logo Design Love
I need to remove all those tags I don't care about, like LAST_MODIFIED="1256428672", ICON_URI="bunch of digits" ICON="bunch of characters" etc.
And of course I need to remove all those tags in every link in the list.
So I was thinking like use something like "Find all tags LAST_MODIFIED="anynumbers" and replace it with nothing/remove it" - it doesn't work though.
Examle how it should like:
Logo Design Love
So far I removed LAST_MODIFIED and ADD_DATE lines thanks to Aleksandr. So LAST_MODIFIED="\d+" worked just fine. But ICON and ICON_URI are still there. I've tried ICON="\w+" - but it doesn't work. I guess it has something to do with the slashes.
Why look for what you don't want when it's easier to keep hold of what you do want and drop the junk?
(<A HREF=".*?").*?(>.*?>)
with
$1$2
Code edited to suit Notepad++ now I know it doesn't need the special chars escaped. Thanks Aleksandr.
Read up on using regular expressions (the java regex tutorials are a good start http://docs.oracle.com/javase/tutorial/essential/regex/), and try one of the online regex tools to help write and test it, such as this one http://gskinner.com/RegExr/
Eg, remove "LAST_MODIF..." with the regex LAST_MODIFIED="\d+"
Otherwise, you may want an XML-specific tool, or even write an XSL. However, I don't know much about that.

Resources