Hi, i have a String Array which comes from a splitted String
string[] newName= oldName.Split('\\');
newName.Last().Replace(newName.Last(), handover);
Why doesnt this replaces my last element in the Array?
last() comes from using linq
regards
...
I want to replace all the occurrences of a string that doesn't start with "<pre>" and doesn't end in "</pre>".
So let's say I wanted to find new-line characters and replace them with "<p/>". I can get the "not followed by" part:
var revisedHtml = html.replace(/[\n](?![<][/]pre[>])/g, "<p/>");
But I don't know the "not starting with" ...
It would work something like this
someUtility.replace ("Hello, my name is {1}. What is your {2}?", "Mark", "name");
Thanks in advance!
...
I have a variable like this
"Folder With Spaces/filename.ext"
When I pass it to my program via PHP's system command, arguments are separated by spaces
system("batch.bat Folder With Spaces/filename.ext");
So I have it like this
system("batch.bat Folder_With_Spaces/filename.ext");
Is there a way now that it is back in the batch pr...
Hi Im trying to replace some html with Jquery, this is what I got so far.
$(".old").html($(".new").html());
This almost work. Only that the .new is being copied, instead of replacing.
I wan't to Cut/Paste instead of Copy/Paste
...
I have a text file with html:
Blah, blah, blah
some text is here.
<div> something here
something else </body></html>
so far, if the tags are on one line this works:
textfile = open("htmlfile.txt", "r+")
text = textfile.read()
a = re.search('<div.+?<\/html>', text)
repstr = c.group(0)
text = text.replace(repstr, '', 1)
works ...
I need to add a backward slash to a string before storing it;
e.g. source "user1@domain1" - i need to store this string into two variables, userid and domain. However for the domain variable, before storing it I want to add a backward slash to the end of the domain name e.g. "domain1\" how can this be done in regex, thanks.
...
To put this in context, consider these 2 functions:
ml_RestrictToChars = function(input,regex) {
var result = '';var c = '';
var rx = new RegExp(regex);
for (var i = 0; i < input.length; i++) {
c = input.charAt(i);
if (rx.test(c)) {
result += c;
}
}
return result;
};
ml_OmitChars =...
My question is very simple, but I didn't get the answer from google.
There is a python string:
s = "123123"
I want to replace the last 2 with x. Suppose there is a method called replace_last:
r = replace_last(s, '2', 'x')
print r
1231x3
Is there any built-in or easy method to do this?
UPDATE
Sorry, guys, since someone said...
I capture the string from a html source file using regex:
f = open(rrfile, 'r')
p = re.compile(r'"name":"([^"]+)","head":"([^"]+)"')
match = re.findall(p, f.read())
And I've tried:
>>> u'\\u4f60\\u4f60'.replace('\\u', '\u')
u'\\u4f60\\u4f60'
>>> u'\\u4f60\\u4f60'.replace(u'\\u', '\u')
u'\\u4f60\\u4f60'
>>> u'\\u4f60\\u4f60'...
Hello,
for a better understanding of the following question, here's a little drawing that illustrates the structure of my App: http://grab.by/6jXh
So, basically I have a navigation-based App that uses NavigationController's "pushViewController" method to show Views A and B.
What I'd like to accomplish is to make a transition from view...
I'm a complete mySQL & PHP noob, and in my table, whenever there is an apostrophe, it gets replaced by ’. I've searched and found that it could be because my table is not UTF-8, but I changed all the collation settings in phpMyAdmin to utf8_unicode_ci, and I still get the ’.
To be clear, I am sending the data to a PHP script from a...
I have a drupal based site (CCK+Views+Taxonomy) with a huge amount of text content. Now consider I would like to convert all the "W" in the content with "w", I have no idea what tables to touch or what fields in those tables, I just know that I want all the "W"s in the site (it's content I mean, database) to be replaced with "w"s, any in...
Is it possible to run some SQL to change the contents of a field?
My field looks like this
..//uploaded_images/1284058574.jpg
and I want it to simply be
1284058574.jpg
all the records that I wish to change will start with
..//uploaded_images/
...
I am working on a search and replace console app to help out some people in my department. I am trying to have them input a file path and also the type of file they would like to search for. if they want to find txt files then it will find all txt files in a directory...stick these into an array and then process the files as needed. I...
VB2005
In my app I present to the user an option to customize the name of the file that gets produced. The format string the program reads is something like
"yyyyMMdd-%1-%2-%3-%4" which the user can customize to his liking.
in this case the format of the date is yyyyMMdd and the %1 is the trip number like 1000P, %2 is the origin code l...
$variable = 'put returns between paragraphs';
Value of this variable everytime changes.
How to add some text before the last word?
Like, if we want to add 'and', the result should be (for this example):
$variable = 'put returns between and paragraphs';
...
how to change
[email protected] into XXX_YYY_ZZZ
One way i know is to use the string.replace(char, char) method,
but i want to replace "@" & "." The above method replaces just one char.
one more case is what if i have [email protected]...
i still want the output to look like XX.X_YYY_ZZZ
Is this possible?? any suggestions thanks
...
Is it possible to use regex to only replace X number of occurrences of a particular string?
For example, if I have the word 'lion' in a string 10 times, could I use regex to only replace the first 6 occurences instead of all of them?
...
$variable = 'for linebreak add 2 spaces at end';
Value of this variable everytime changes.
How to add some text or html before and after this string?
E.g. if we want to add '<div>' before and '</div>' after, string should look like:
$variable = '<div>for linebreak add 2 spaces at end</div>';
...