I've got a multiline string like this. Ity has line feeds.
[Site Url="http://medportal.domain.edu" Owner="DOMAIN\user1" SecondaryOwner="DOMAIN\user2" ContentDatabase="WSS_Content_$1" StorageUsedMB="0.8" StorageWarningMB="0" StorageMaxMB="0" /]
[Site Url="http://medportal.domain.edu/sites/ahSC" Owner="DOMAIN\user1" ContentDatabase="WSS...
I have a list of tags:
>>> tags_list
['tag1', 'second tag', 'third longer tag']
How can I replace whitespaces within each element of the list with "+" ? I was trying to do this with regular expressions but each string remains unchanged:
for tag in tags_list:
re.sub("\s+" , " ", tag)
What is wrong with my approach ?
EDIT:
Yes ...
Hello,
I want to write a script which adds in a string a backslash () everytime it finds a quotation marks or \r. It works but for " and ', but I don't know how to write it for \r. Could anyone help me? THANKS
<script type="text/javascript">
var test="Let\'s test if this \"works\" properly";
var escapedString = test.replace(/(['"])/g, ...
Hi.
How do I remove all matching substrings in a string? For example if I have 20 40 30 30 30 30, then I just 20 40 30 (and not the other 30s). Do I use a regex? If so, how?
...
Hello,
We would like to do a replace in our string like this:
- Every time a \n (new line) or \t (tab) or \r (carriage return) appears, it should be replaced by the string "\n" or "\t" or "\r".
For example, this string:
"Hello, how
are you?
Fine thanks."
Should be replaced by:
"Hello, how\n\tare you?\nFine thanks."
Could you help ...
Hello,
Lets say I want to replace the following string within a textfile:
document.write(unescape("%3Cscript src='" + \ + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
I came up with this sed command, but surprisingly nothing happens at all.
sed -i "s/document.write(unescape(\"%3Cscript src=\"\' + \\ + \"go...
Hi,
I'm looking for a function in Scheme to replace a element in an equation by a value.
Exemple : '(+ a b c a) with (1 2 3) should give me '(+ 1 2 3 1). (I don't want to resolve the equation, it was just an exemple)
Basically, I want to say that a=1, b=2, c=3
To proceed, I extract the variables of my first list in another list.
The...
What's the problem with this?
the hash is : #/search=hello/somethingelse/
window.location.hash.replace(/search=([^\/]*)/gi, "search=" + value);
EDIT:
I want to change just a specific part of the hash not the whole hash.
...
I want to replace all font-size-parameters in a html document (css attributes).
I'm using .net with c#.
I guess it could be done with some regular expression.
Am I forgetting some other ways to set the font size?
Example:
<html>
<head>
<style type="text/css">
.t {
font-size: large;
...
Hi,
I have a stored proc, say, "call_Me" with few parameters:
Declare @Greet varchar(100) = 'Hi ||User||'
Exec Call_Me 1,'something', @Greet --parameters: bit, string, string
during the call, I want to be able to replace the
||User||
bit with something else. normally, in a select statement, I would do this:
select 1, 'somethin...
Hi,
I'm looking for a way to replace a string in php that exactly matches with the subject.
For example I got a file named 'hello-world.txt' having three lines:
'http://www.example.com/'
'http://www.example.com/category/'
'http://www.example.com/tag/name/'
and I need to replace the 'http://www.example.com/' with 'http://www.example2....
Hi,
I'm trying to replace all dots found in a value entered by the user in an HTML form.
For instance I need the entry '8.30' to be converted to '8x30'.
I have this simple code:
var value = $(this).val().trim(); // get the value from the form
value += ''; // force value to string
value.replace('.', 'x');
But it doesn't work. Using t...
Hi,
I am using jQuery editor with PHP it works fine for plane text (text with out special characters)
but if I try to post text which contain special characters then it does not store these special characters in to db table..
and when I tried to replace any special character with HTML codes it works fine.
But it is too difficult to repla...
I need to convert all paths with '\' in them to '/'. The makefile is quite long and doing this manually is impossible.
Is there some way to quickly convert them? Keep in mind that a global replace is not possible because '\' is also used to denote that a command is continued on the following line.
...