Programming :: Javascript Many Characters As Reg Expression Replace?

Jan 2, 2010

I'm working with javascript and trying to replace all instances of a Roman character in a string with nothing. How do I assign var reg to all Roman characters? In UTF8, capital letter A is U0041 and at the other end, small z is UFF5A.

So, I'd like to do something like:
var reg = u0041 - UFF5A;
str1 = str.replace(reg, '');

I think you get the idea. I have no idea if that can be done. The idea is to take this string (for example): str = make a door-to-door[house-to-house] visit / ring every doorbell." And take out all the Roman characters and define it as str1. And then take out all the Korean characters (u1100-uFFDC) and define it as str2. In fact, a WAY more useful thing to do would be to replace the instance of this: [u1100-uFFDC]+" "+[u0041-UFF5A] with [u1100-uFFDC]+","+[u0041-UFF5A] so that the output would be a .csv file.

View 5 Replies


ADVERTISEMENT

Programming :: Regular Expression Working Fine In JavaScript But Not In Python?

Jun 22, 2010

I have this regular expression

Code:

(@description ").*(";)

I want to match anything in between the quotes its working fine in JavaScript but its not working in my python program:

Code:

#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import re

[code]....

View 3 Replies View Related

Programming :: Python Replace() With Regular Expression?

Mar 16, 2011

i cant use regular expression in replace function. I want to do this

a = ' Bad boy'
b = a.replace("b[aA]d", '')

Ofcourse this is a simple example for my query. Its not working so shall i assume regex dont work with replace function ?

View 1 Replies View Related

Programming :: Replace A Certain Range Of Characters In Unix?

Mar 8, 2010

I have a hard time figuring this out. I need to replace the date formats of arrival date(column 31-40) and departure date(column 42-51) and I need 2 outputs. I cannot even figure out how to start.code...

View 6 Replies View Related

General :: Regular Expression To Match Unspecified Number Of Characters Until A '>'?

Jul 7, 2010

I'm attempting to search through a rather large assortment of html files created in Word using 'save as html'. what I'm trying to do is find and delete these tags (they're causing browsers to display black diamonds with white question marks):

<span style='mso-spacerun:yes'> </span> Tags contain from 1 to 4 spaces between opening and closing. I get positive results from this:

grep <span style='mso-spacerun:yes'> filename.html but once I attempt to tell it to match any number of characters up until the next '>' symbol, it tells me I'm using an invalid regex: grep <span style='mso-spacerun:yes'>[^>]+> filename.html

I've been nose-deep in regex tutorials for the past day or so, and I'm still not understanding why this doesn't work. If I put the pattern (without backslashes) into a separate file and use `grep -f patternfile filename.html`, I get no error but no matches either. So far as I can figure, the above regex boils down to:
Match the string "<span style='mso-spacerun:yes'>", followed by any number of characters that are not a ">", followed by a ">". If someone could tell me where I'm going wrong with this,

View 7 Replies View Related

General :: Regular Expression In VIM Search And Replace?

Oct 22, 2009

I have two type of lines in a text file example

Code:

x.junk(a,b,YAHOO);
y.junk(c,d);

I want to search and replace the second type of line with the first type i.e. with YAHOO included, so that I have

Code:

x.junk(a,b,YAHOO);
y.junk(c,d,YAHOO);

I am trying to use

Code:

:%s/(.*).junk((.*),(.*)^<YAHOO>);/1.junk(2,3,YAHOO);/

In the above code ^<YAHOO> search is not working (I want lines "except YAHOO"). I know that [^ab] will work for "except a,b" characters. How can I say "except word" in regular expressions?

View 8 Replies View Related

Ubuntu :: Use PyRenamer To Identify And Rename Files With Reserved Characters In The File Name / Expression

Aug 2, 2011

I'd like to use pyRenamer to identify and rename files with reserved characters in the file name. The files came from windows where I'm guessing the characters didn't cause problems. For example, I want to replace the ? (question mark), ' (single quote), etc. I tried using the escape () character before the special character in the replace field on the substitutions tab, but for some reason I don't believe that method was identifying the special characters. What is the correct way to identify a special / reserved character within a file name and replace it?

View 1 Replies View Related

General :: Regular Expression Search And Replace In Writer Or Gedit?

Oct 26, 2009

I've got a list of files that I've copied from my terminal and pasted into gedit and into OO.o writer. Since the files are all created by gedit, in each case there is both file and file~. I want to get rid of all the 'file~' lines. I thought I could do search and replace using *~, but this doesn't work.

View 4 Replies View Related

General :: Replace Characters In Txt File?

Nov 7, 2010

I have txt file with list of ID's and I need to insert comma in every line and then remove new line character so it'll become one long string. So to clarify, I have txt file content that looks like this.

234
5466
2356
... and so on.

but I would like this to change to 234,5466,2356,... I looked at sed and tried to wrap my head around the commands but I guess my brain isn't smart enough. its really confusing for me. I've managed to add commas to end of line (sed "s/$/,/g" filename) but somehow I can't seem to remove new line character from each line.

sed 's/[

]*$//' doesn't seem to work.

View 4 Replies View Related

Ubuntu :: Replace Strings Containing Special Characters With Sed?

Jan 4, 2011

here's my newbie question - I want to change the following string in text files

Code:
E:MP3
with the following string using sed:

[code]....

View 3 Replies View Related

Software :: Using Sed To Replace Special Characters In A File?

Mar 24, 2011

I have a file with special characters that need to be replaced. I've been working on this for a day and have run out of time.

Example: FILE='/var/tmp/S0000000.LOG.March-24-2011:10:51.tar'

Need to replace the ' with a " on all lines in the file.

View 2 Replies View Related

General :: Using Sed To Replace String With Special Characters In XML File?

Apr 29, 2011

I am having difficulty getting sed to replace a string of text in an XML file, despite the fact that I have no trouble using grep to find that same string. Since the new string and old string to be replaced contain a lot of special characters, I thought it best to store them in variables as opposed to using a slew of backslashes:

OLD_STRING='<property name="webServiceHost">${jboss.bind.address}</property>'
NEW_STRING='<!--<property name="webServiceHost">${jboss.bind.address}</property>-->'

[Code]....

View 2 Replies View Related

Ubuntu :: Script To Replace Characters In Text File?

Jun 30, 2011

I have an odd request, lets say I have a text file like this:

Quote:

Code:

__##___##___IIIIII
__##___##_____II__
__##___##_____II__
__#######_____II__
__##___##_____II__
__##___##_____II__
__##___##___IIIIII

I want a script that will replace all of the hash tabs with random characters.I found this command will generate a random character

Quote:

apg -a1 -n1 -m1 -x1 -d

how to script a search and replace using that random character upon each successive find until the end of file occurs.

View 9 Replies View Related

General :: Replace New Line With <br /> And Escape Special Characters?

Feb 6, 2011

I wish to replace a new line with br (html) but it doesn't seem to work

Code:

message=$(echo ${FORM_message} | tr '
' '<br />' )

what it gives me seems to be ... b...? I am also having problem escaping hash sign in cut command:

Code:

list=$(echo "$line" | cut -d'#;#' -f1) ;

my intention is to split the line with "#;#"

View 5 Replies View Related

General :: Search And Replace String Having Multiple Special Characters

Aug 26, 2009

Below is extract of my file:

What I need is to replace "--destination-path=" with "--destination-path=/home/dest"

i.e. desired output is ----destination-path=/home/dest

I could achieve it with below command

$cat outgoing-xfer|grep destination-path|perl -pi -e "s/destination-path=/destination-path=/home/dest/g"

But the problem is that in this case i just wanted to append "/home/dest" for which I could easily escape "/" with just two "", but I wonder if i have a long path like "/a/b/c/d/e/f/g/h/i/j" I will have to escape so many /. Is there any other way by which I can avoid escaping forward slash.

I tried following:

But receiving follo error

Bareword found where operator expected at -e line 1, near "s/destination-path=/'destination-path=/home"
syntax error at -e line 1, near "s/destination-path=/'destination-path=/home"
Bad name after dest' at -e line 1. tried with enclosing in double quotes as well but in vain

View 5 Replies View Related

Ubuntu :: Mapping HAL's .fdi Expression To Xorg Expression?

Oct 6, 2010

I want to translate this .fdi clause

Quote:

<match key="info.product" string="PS/2 Generic Mouse">
<merge key="input.x11_options.EmulateWheel" type="string">true</merge>
<merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>[code].....

into its Xorg equivalent. What does it look like?

View 1 Replies View Related

Programming :: Executive JavaScript Function Along With URL

Jun 15, 2011

There is this sample web page: [URL] and it has a clickable link / button that executes a JavaScript function: (Right-Click and Copy Shortcut would give this piece of code)

Code:
javascript:__doPostBack('lbtnUpdateStatus','')
whereas the source code for the link / button is as follows:
Code:
<a id="lbtnUpdateStatus" href="javascript:__doPostBack('lbtnUpdateStatus','')">

I want to automate the above function / link along with the said URL so that I won't have to open the webpage and click the button / link. I want a single URL hitting which we won't need to do the extra effort of "clicking the link / button" that executes the JavaScript function given above. I can't automate this task in the source webpage itself because that has to be there as it is for the users who access the webpage. How to achieve it?

I got some useful information here: [URL] but I want to call a javascript function along with a URL such as this:
Code:
[URL] javascript:alert("OKAY")
but the above line of code won't work.

View 9 Replies View Related

Programming :: Slideshow Of Images In Javascript?

Jun 28, 2011

Check out the frontpage of mail.com - how do I do the scrolling images in Javascript, like it's doing?

View 4 Replies View Related

Programming :: Javascript GUI Stuff On 123reg?

Jan 11, 2011

I went to [URL] the other day, and I'm really impressed with the way, when you click on domain, it adds it to the cart WITHOUT A REFRESH. But what I really want to know is - how does it do the slick little effect when you click "Add to basket", when it "appears" on the right hand side?

View 4 Replies View Related

Programming :: Javascript Line Break

Feb 25, 2011

I have some variables that are loaded from mysql - in mysql, the line breaks are not indicated by ' or '<br>' or anything -they are just line breaks. the variable is loaded into javascript and then inserted into a <pre> element. the line breaks are not showing up.

pre1 = pre1.replace(/>/g,">"); - this works well, naturally. but how do i get those line breaks to show up as line breaks in a browser?

I've tried many variations of something like:

View 1 Replies View Related

Programming :: Javascript To Verify Correct URL?

May 31, 2011

Lets say I have a site "Website1.com"

On that site I want to run a little javascript that verifies that the site was accessed as "Website1.com" and not "dev-Website1.com"

If it was accessed correctly, nothing happens. If it was accessed incorrectly, it displays an error saying "You are trying to access this site incorrectly."

What is the simplest way to accomplish this?

View 1 Replies View Related

Programming :: JavaScript - Window.onbeforeunload

Nov 13, 2010

I am using window.onbeforeunload to keep people from accidentally leaving. I was hoping to intercept this event, run my own dialog box and load another page that closes the window, or of course, cancel.

I'm needing this because my site is a single page and I can't figure out how long people are visiting for, if I could load an exit page, then I can figure this out.

View 6 Replies View Related

Programming :: Understanding This Construct In Javascript?

Dec 3, 2010

var param = function() { <whatever> } ;What exactly does the above MEAN, and why have they included this in the language this way?

View 6 Replies View Related

Programming :: Trying To Understand This Function In JavaScript

Dec 9, 2010

In my book, this is an example of a recursive algorithm:

var reverseArray = function(x,indx,str) {
return indx == 0 ? str : reverseArray(x,--indx,(str+= " " + x[indx])) ;; }
var arr = new Array('apple','orange','peach','lime');
var str = reverseArray(arr,arr.length,"");
alert(str) ;

I'm trying to understand it, I'm stuck at the (str+= " " + x[indx])) part - that part of the function definition expects an ARGUMENT, am I right? What's being passed to it is a bit of PROGRAM, the str+= stuff. So - how is it working?

View 7 Replies View Related

Programming :: What Does The Following Shell Script Expression Mean

Nov 30, 2010

I've found the following script to copy files specified by a find output into a target directory.Code:find $SOURCE -name "*.avi" | xargs -i cp -v {} $TARGETWhat exactly does the colored expression mean? Does it refer to an array?

View 3 Replies View Related

Programming :: Audio Level Meter In Javascript

May 23, 2011

When someone is speaking into the mic, I'd like a "level meter" such as the one that comes with gnome sound recorder, that flashes up and down when a sound is made or somebody talks.This will be done in Javascript, using the brand new "Rainbow API", i.e. inside the browser.I know nothing about audio programming, so - where would I get *started* with something like this? Could anyone tell me at least WHAT to Google?

View 3 Replies View Related

Programming :: JavaScript - File Not Recognized As XML By Firefox

Feb 4, 2010

I'm loading an XML file stored in a tiny web server (based on lwip). This web server is not very cooperative and is not marking the http content-type as "text/xml". As result, Firefox is not recognizing the file as xml (IE does) so I can't use DOM methods for parsing the xml file. overrideMimeType("text/xml") should help me avoid this problem but, even having overrided the mymetype, the content-type received is still "text/plain". This is a portion of my JavaScript code:

Code:
var xmlObj;
// loadXMLdata is called from the html file
function loadXMLdata() {
var dataFile = window.location.href.substring(0, window.location.href.lastIndexOf("/") + 1) + "config/myfile.xml";
if (window.XMLHttpRequest) {
xmlObj = new XMLHttpRequest();

// This should override the mimetype...
if (xmlObj.overrideMimeType)
xmlObj.overrideMimeType("text/xml");
xmlObj.onreadystatechange = fillXMLdata;
xmlObj.open("GET", dataFile, true);
xmlObj.send("");
} else {
alert("Your browser can not handle this script");
return; } }
// fillXMLdata is called from loadXMLdata once the xml object is ready
function fillXMLdata() {
if (xmlObj.readyState == 4) {
// Here Content-Type shows again "text/plain"
alert(xmlObj.getAllResponseHeaders());
var xmlDoc = xmlObj.responseXML.documentElement;
// And here section is null
var section = xmlDoc.getElementsByTagName("section")[0]; } }
The xml is quite simple:

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<section>
<item>1</item>
<item>2</item>
</section>

View 1 Replies View Related

Programming :: Javascript Image Sliding Direction?

Jun 2, 2010

im trying to learn javascript. so i choose to start out making a image slideshow banner that auto scrolls on load no special buttons. so since i had no idea were to start i found code that was free to use commercial and non commercial and ill be able to change it. heres that code:

Code:
var SLIDETIMER = 3;
var SLIDESPEED = 3;

[code]....

View 2 Replies View Related

Programming :: Playing Sound In Javascript And HTML5?

Jan 14, 2011

I can play a sound on my local machine using the following code, but when I upload to a server the same code it does not play. I cannot work out why, the link below gives the code. The multi channel code is here:

[URL]

Code:
<audio id="multiaudio1" src="audio/flute_c_long_01.wav" preload="auto"></audio>
<audio id="multiaudio2" src="audio/piano_chord.wav" preload="auto"></audio>
<audio id="multiaudio3" src="audio/synth_vox.wav" preload="auto"></audio>
<audio id="multiaudio4" src="audio/shimmer.wav" preload="auto"></audio>

[Code].....

View 4 Replies View Related

Programming :: The Perfect Javascript Tutorial Or Book?

Jul 30, 2011

I'm looking for javascript tutorials or books that meets the following criteria:

1. Very thorough: Starts with the most fundamental concepts and progresses logically from basic to advanced concepts, without skipping over important ideas for the sake of expediency.

2. Lots of small practice exercises that parallel the concepts and syntax being learned.

I've looked at a lot of tutorials, but they all tend to be lacking in one of these areas or the other.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved