I need to add a string before CSS elements with Javascript code. An example of the original code:
h1 {
background: red;
}
.class #id {
color: black;
}
I want Javascript to filter it like this:
.myclass h1 {
background: red;
}
.myclass .class #id {
color: black;
}
Let's say the CSS-code is a Javascript string called st...
I am writing a script for customising a configuration file. I want to replace multiple instances of strings within this file, and I tried using powershell to do the job. It works fine for a single replace, but doing multiple replaces is very slow because each time it has to parse the whole file again, and this file is very large. The scr...
I have a very large numpy array (containing up to a million elements) like the one below:
[ 0 1 6 5 1 2 7 6 2 3 8 7 3 4 9 8 5 6 11 10 6 7 12 11 7
8 13 12 8 9 14 13 10 11 16 15 11 12 17 16 12 13 18 17 13 14 19 18 15 16
21 20 16 17 22 21 17 18 23 22 18 19 24 23]
and a small dictionary map for replacing some of t...
i have a string which is a paragraph written on the aspx side. So its goes like this.
The new student, {student_name} has the following grades -
Maths - {math_grade}
Science - {Science_grade}
...
and so on.
I need to get values from database, and replace {student_name} with "Joe Smith", {Math_grade} wth A or B+ etc.
how can i do this?...
I have the following string and regex:
var string = "Dear [to name], [your name] has decided to share this [link]";
var patt = /\[+[A-Za-z0-9]+\]/;
I want to be able to change each of the bracketed variables with dynamic input. How would I use match() or replace() to target the 1st, 2nd and 3rd occurrences of this regex?
EDIT: At th...
Is it possible in C++ to replace part of a string with another string. Basically, I would like to do this
QString string("hello $name");
string.replace("$name", "Somename");
but I would like to use the Standard C++ libraries.
...
Hello,
I would like to make a whole word replace using php
Example :
If I have
$text = "Hello hellol hello, Helloz";
and I use
$newtext = str_replace("Hello",'NEW',$text);
The new text should look like
NEW hello1 hello, Helloz
PHP returns
NEW hello1 hello, NEWz
Thanks.
...
I'm trying to write something that format Brazilian phone numbers, but I want it to do it matching from the end of the string, and not the beginning, so it would turn input strings according to the following pattern:
"5135554444" -> "(51) 3555-4444"
"35554444" -> "3555-4444"
"5554444" -> "555-4444"
Since the begining portion is what u...
In Perl, the operator s/ is used to replace parts of a string. Now s/ will alter its parameter (the string) in place. I would however like to replace parts of a string befor printing it, as in
print "bla: ", replace("a","b",$myvar),"\n";
Is there such replace function in Perl, or some other way to do it? s/ will not work directly in t...
I am looking to replace values in a particular column. For example the following column values
column name
----------
Test1
Test2
Test3
Test12
Test14
should be (replacing est1 with rest1)
column name
----------
Trest1
Test2
Test3
Trest12
Trest14
I know this should be simple but not able to get the exact function. Any help is apprec...
Hi,
i have an HTML, that should be transformed, having some tags replaced with another tags.
I don't know about these tags, because they will come from db. So, "set_attribute" or "name" methods of Nokogiri are not suiteable for me
I need to do it, in a way, like in this pseudo-code:
def preprocess_content
doc = Nokogiri::HTML( self...
I have the below situation
Case 1:
Input : X(P)~AK,X(MV)~AK
Replace with: AP
Output: X(P)~AP,X(MV)~AP
Case 2:
Input: X(PH)~B$,X(PL)~B$,X(MV)~AP
Replace with: USD$
Output: X(PH)~USD$,X(PL)~USD$,X(MV)~USD$
As can be make out that, always the ~<string> will be replaced.
Is it possible to achieve the same through regular expressi...
I have a string containing a valid Clojure form. I want to replace a part of it, just like with assoc-in, but processing the whole string as tokens.
=> (assoc-in [:a [:b :c]] [1 0] :new)
[:a [:new :c]]
=> (assoc-in [:a
[:b,, :c]] [1 0] :new)
[:a [:new :c]]
=> (string-assoc-in "[:a
[:b,, :c]]" [1...
Need help understanding what I am doing with the syntax here, please help! I not only need to convert from float to decimal but I also need to override the original data being migrated to the same format and data (in this case) where necessary to match the newer data.
,CASE
WHEN fInvReqMargin IS NOT NULL THEN
(CONVERT(DECIM...
Hi is there any way to 'replace' all occurences of 10 or more occurances of _ (underscore) within a mysql table with something else.
background
I've inherited a database of content written for the web.
Unfortunately the origional author has used ________________ instead of <hr /> for the horizontal rules.
It's a wordpress installation...
I try to get all occurences of a pattern from a file, but currently I fail if there is more than one occurence per line.
Sample line in file:
lorem ipsum foo="match1" lorem ipsum foo="match2" lorem ipsum
The output I want:
match1 match2
I tried getting this using sed:
sed -ne 's/^.*foo="\([^"]*\)".*$/\1/p'
With this expression ...
Hello,
I have a simple text that is being parsed with PHP. In that text, I sometimes use following syntax:
Here's the text... {$video:path/to/my/video.mp4} and here the text goes on.
Now, what I need, is, by means regex, to replace this {$video:path/to/my/video.mp4} with the returned string of this: $someObject->processVideoSource('p...
I am trying to use VBA in Microsoft Word to automatize highly repetative operations on large documents.
The situation is this: I have a technical text containing a lot of special characters, e.g. ❨ (U+2768) and ❩ (U+2769). The text is chiefly typeset in Cambria, but some of the special characters are not found in this font. However, I ...
Hi All,
Please excuse my noob-iness!
I have a $string, and would like to see if it contains any one or more of a group of words, words link c*t, fu*, sl** ETC. So I was thinking I could do:
if(stristr("$input", "dirtyword1"))
{
$input = str_ireplace("$input", "thisWillReplaceDirtyWord");
}
elseif(stristr("$input", "dirtyWord1"))
{
...
Hi. I have been scratching my head trying to get Jquery to conditionally search and replace title tags in a document. Essentially I want Jquery to go through a list of image tags, check if the image tag is a space " " and if so remove the space "". If the title tag is anything else Jquery should leave it alone.
HTM i am not allowed to a...