Regex strings for uploads folder - regex

I'm using "Safe Search and Replace on Database with Serialized Data v3.1.0" to do a search and replace of my database. I've been trying to write it myself but haven't had any luck and Google seems to not have the answer I'm looking for.
Basically I need a string that will target upload folders from 2010-2015 with jpg|jpeg|png|gif file types that I can replace the string with a simple placeholder.png file I created.
Here's what I've managed to make that doesn't seem to work lol sorry if it's just terrible:
(uploads)(.*?).(jpg|png|gif|jpeg)
or
^\/wp-content\/uploads\/((2014|2013|2012|2011)|(2015\/(01|02|03|04|05|06|07|08)))\/(.+)(jpg|png|gif|jpeg)
I've tried other variations I've made but when conducting a "dry run" it states that 0 cells would have been changed.
The image urls are full and not relative.
Can anyone assist?

Please try:
(uploads\/201[0-5]\/(?:0[1-9]|1[0-2])\/.*?\.(?:jpg|png|gif|jpeg))
REGEX 101 DEMO

Hope this works for you:
^\/wp-content\/uploads\/(201[0-4]\/\d{2}|2015\/0[0-8])\/(.+\.(jpg|png|gif|jpeg))$
I tested it here: regexp101.
You will find more in depth-explanation there.
Be aware that the uploads folder format can be changed in the Dashboard.

Related

IntelliJ: find file name with regex

IntelliJ have multiple ways to find things.
What I need is to find a file by name. It seems easy by pressing two times Shift.
The problem is, in the window that opens
that is seems to be no way to use regexp!
If a try to use a very simple one, to find files that not contains solr
Same for all kind of regex... does it exists a solution/workaround to this?
This feature is not yet supported, please vote for IDEA-257632 to be notified on any progress with it

Nifi: ReplaceTextWithMapping doesnt work as expected

I have been trying out examples in nifi and has been trying out the ReplaceTextWithMapping processor. The processor config as given below.
The mapping file is shown below.And I have used tab space between key and value.
I have followed this article here. And there is a lots of ID in the input file to the processor.There is no error on the logs. Can someone help me understand the problem.
The only workaround I could find was giving the values directly like (ID|POS). This does work. But still don't know why regex is not working.

Is there a way to write to a file in online CMS from a local C++ program?

I created a very customized leaflet map on a Bitrix website (they forced me to, not my choice). Now other coworkers who are basically "afraid" of code need to be able to add markers to that. I already created a C++ program where they can simply enter all the details they want (what category, whats the popupcontent etc.) and it spits out the geoJSON code for the marker for them to copy and paste into the website.
To make it even more easy for them I am wondering if there is a way to basically have my program connect to the internet, go to the backend of my website and, after asking for login, adds the code to the respective .js file that contains only the marker code.
I have been googling the problem but unfortunately couldnt find any other related posts.
Okay I finally found the I guess easiest way, I will force my colleagues to install python and write a little thingy to concatenate the code and upload it using Selenium. Thanks for your help guys!

Aspell add word to personal dictionary using pipes

I'm using Aspell through pipes, and would like to know how can I add a new word to my personal dictionary.
For example, to check spelling for the word "tesst" I use:
echo tesst|aspell -a -p .aspell.en_US.pws
Here is explained that I can use "*word" to add this word to my personal dictionary:
echo *tesst|aspell -a -p .aspell.en_US.pws
But it doesn't.
What I'm doing wrong?.
Have you saved your personal dictionary ?
A line prefixed with # will cause the personal dictionaries to be saved.
Hope this helps
I could not make Aspell6 working with personal dictionaries. Instead I had to create extra-dictionaries as I explain at http://vouters.dyndns.org/tima/Linux-Windows-Perl-Aspell-Determining_the_country_of_a_Web_query.html. Otherwise I was getting an error from Aspell. If you read the Perl code at the above URL it uses the Aspell6 'extra-dicts' feature. This was my only workaround to Aspell's personal dictionaries.
FYI: the goal of the Perl code is to determine the language spoken by a Web visitor leaving his query into a company's Web search engine. All the queries are stored within an xlsx Excel file. The final purpose is to determine whether the translation of a company's English written Web document is financially worth to translate it to a local dialect.
In the hope this will help you.
Philippe Vouters (Fontainebleau/France)

Get a particular text from website

I'm looking for a way if you know the location where to read the text for example say, under a particular category, how would you connect to a website and search & read the text from it?
what steps do i need to follow to learn about that?
you could use libcurl/cURL for your HTML retrival
You're probably looking for a web crawler.
Here's an example of a simple crawler written in C++.
Moreover, you might want to have a look to wget, a software to retrieve files via HTTP, HTTPS and FTP.
if you are looking at a specific web-page, you could try retrieving the page and parsing it to get to the exact location you want. e.g. specific div, etc.
since you are using c++, you could try reading up on using libcurl to retrieve the information you need from the URL.
You can download an html file with WinHTTP(working example) and then search the file. There's some find algos in the std::string class for searching if your needs are relatively basic.