var html = "<div>"+title+"<br/>";
document.write(title.replace(/ /g,"-"));
html+= '<p><a href="go.aspx?title=' + title + '">Details<\/a></p></div>';
hi all,i want to replace title space with dash
hi,
since eregi replace was deprecated on version 5.3 i want to make my program compatible with new version of php
http://php.net/manual/en/function.eregi-replace.php
so, i'm trying to use preg_replace like this
preg_replace(",",'','20,000.00');
but come with error
i'm familiar with eregi_replace(',','','20,000.00'); i'm not familiar with regex expression. what is the best replacement for eregi_replace?
For example:
<input type="text" name="test" onChange="document.formname.test.value=.document.formname.test.value.replace('something','something else')" />
The replace function works but it loses focus on every change
How do you make it not lose focus?
What I'm trying to do is make it so that certain text is immediately replaced with new text when its typed but you can continue typing
I need to match two cases by one reg expression and do replacement
'long.file.name.jpg' - 'long.file.name_suff.jpg'
'long.file.name_a.jpg' - 'long.file.name_suff.jpg'
I'm trying to do the following
re.sub('(\_a)?\.[^\.]*$' , '_suff.',"long.file.name.jpg")
But this is cut the extension '.jpg' and I'm getting
long.file.name_suff. instead of long.file.name_suff.jpg
I understand that this is because of [^.]*$ part, but I can't exclude it, because
I have to find last occurance of '_a' to replace or last '.'
Is there a way to replace only part of the match?
Hi - I am looking for a solution to replace an image with another image when you focus on a text field.
There are 4 text fields and 5 images (1 image is the default image)
When you focus on each of the text fields, the correct image should replace the default image..
Thanks for any guide on this
Hi, my app presents a listview, from a database cursor and XML, that needs to replace the values in a column with various words based on the integer value contained in the cursor. For example, if the value is -1, replace it with the word "Invalid", but if the value is = 0 then just display the value.
I was under the impression this could magically be done via XML... TIA.
I have and NSMutableArray and I want to replace it with another, but if I try to do it like this...
firstArray = secondArray;
...then it seems to erase the entire firstArray and I get this error message..
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)'
...and the bounds should be (6) not (0).
Is there a correct way to replace the array?
PS: I already checked the secondArray and it functions fine.
use sed to replace every occurrence of /dir with $dir (replace / with $) in every script in a directory.
sed "s#/dir#$dir#g"
The $ keeps being interpreted as a function or variable call.
Is there a way around this?
thanks
How to FindandReplace the 'Enter' characters in the text file? Here is my code:
string searchString( "\r" ); // <------- how to look for ENTER chars?
string replaceString( "XXXX" );
assert( searchString != replaceString );
string::size_type pos = 0, pos3 =0;
while ( (pos = test.find(searchString, pos)) != string::npos ) {
test.replace( pos, searchString.size(), replaceString );
pos++; }
How to replace space and dash coming together with only dash in php
e.g below is my url
[url] = http://kjd.case.150/1 BHK+Balcony- 700+ sqft. spacious apartmetn Bandra West
In this I want to replace all special characters with dash in php.In url there is already 1 dash after balcony.If i m replacing dash with special chars then it becomes two dash bcoz already there is 1 dash in url and i want only 1 dash.
I do something like
UPDATE OR REPLACE someTable SET a=1, b=2 WHERE c=3
I expect if it doesnt exist it will be inserted into the DBs. But nothing happens and i get no errors. How can i insert data, replace it if it already exist and use a where for the condition (instead of replacing BC of a unique ID)
Hi Guys I have this Table
I need to replace the First Letter in ACCT_NAME with the First Name of ACCT_SHORT_NAME. Records like the Higliighted(RAFFMAN) should not be changed. I have tried:
select acct_name, ACCT_SHORT_NAME,replace(acct_name, substr(acct_name, 1, 1), ACCT_SHORT_NAME)
from tbaadm.gam where schm_type = 'TDA' and rcre_user_id = 'SYSTEM' and substr(acct_name,2,1) = ' '
I am getting:
This means that am Picking the whole value in ACCT_SHORT_NAME. WHat is the best way to do what am trying to do?
I'd like to use Javascript to replace all instances of \u009 in a string
This doesn't seem to be working: .replace(/\u0009/g,'');
Do I need to escape something?
Hello,
I am using a regular expression search to match up andreplace some text. The text can span multiple lines (may or may not have line breaks).
Currently I have this:
$regex = "\<\?php eval.*?\>"
Get-ChildItem -exclude *.bak | Where-Object {$_.Attributes -ne "Directory"} |ForEach-Object {
$text = [string]::Join("`n", (Get-Content $_))
$text -replace $RegEx ,"REPLACED"}
Hi all
There are a lot of numbers like 200 20.5 329.2...in a file. Now, I need replace every number A with A*0.8. Is there any simple method to replace original value with another based on original value?
Best Regards,
Maybe it's just too late for me to do this, but I'm trying to replace a character between 2 string with regex in PHP.
Example string:
other | text [tag]text|more text|and more[/tag] end | text
My goal is to replace | with <br/> between [tag] and [/tag].
Tried with this, seems it wasn't that easy though:
/<td>(\|)<td>/gsi
Searched a bit, but couldn't make out an answer with the stuff I found.
Hope you can help, thanks
I want to replace new lines in text with coma or space but do not change the last new line.
I know of this question: How to replace new lines with tab characters - but it does produce an tab on end instead of new line.
So far I have come with:
awk 'NR>1{printf","} {printf $1} END{printf"\n"}'
Is there an easier way to do this? This is not an assignment, I am just curious want to level up my scripting.
I had a regex that replaced all URLs from a given string:
my_string = "www.example.com test www.mysite.com"
my_string.gsub!(/[a-zA-Z0-9\-\.]+\.(com|net|de|org|uk|biz|info|co.uk|es|de)(\/\S*)?/i,'(site hidden)')
As a result of the above I get: "(site hidden) test (site hidden)"
How could I change the regex to not replace www.mysite.com ???
It means that the replace should output "(site hidden) test www.mysite.com"
Thanks !
I'm using Topsy plugin for wordpress, but i wnnat to customize with more option like change background.
how can i replace the topsy css file?
the css file is loaded after my css and use many !important andreplace my customization.
tks!
Hi,
How to replace symbol "%" with a word "Percent".
My original string is "Internal (%) External (%)".
The string should be "Internal (Percent) External (Percent)"
Using regular expression, how I can replace this symbol?
Thanks in advance.
Atul
I am trying to pass a PCI compliance test, and I'm getting a single "high risk vulnerability".
The problem is described as:
Information on the machine which a web server is located is sometimes included in the header of a web page. Under certain circumstances that information may include local information from behind a firewall or proxy server such as the local IP address.
It looks like Nginx is responding with:
Service: https
Received: HTTP/1.1 302 Found
Cache-Control: no-cache
Content-Type: text/html; charset=utf-8
Location: http://ip-10-194-73-254/
Server: nginx/1.0.4 + Phusion Passenger 3.0.7 (mod_rails/mod_rack)
Status: 302 X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.7
X-Runtime: 0
Content-Length: 90
Connection: Close <html><body>You are being <a href="http://ip-10-194-73-254/">redirect ed</a>.</body></html>
I'm no expert, so please correct me if I'm wrong: but from what I gathered, I think the problem is that the Location header is returning http://ip-10-194-73-254/, which is a private address, when it should be returning our domain name (which is ravn.com).
So, I'm guessing I need to either hide or replace the Location header somehow? I'm a programmer and not a server admin so I have no idea what to do... Any help would be greatly appreciated! Also, might I add that we're running more than 1 server, so the configuration would need to be transferable to any server with any private address.