Recording Positions Of Multiple Substrings That Match A Regexp

Apr 11, 2007

Is there a way to get the position of multiple substrings that match a
regexp without using closures? match() returns the substrings
themselves, not the positions, and search() seems to only return the
first position. Here's what seems to work (under Shanti Rao's jsdb.exe
shell) but I get a bit nervous about using closures Code:

View 1 Replies


ADVERTISEMENT

Multiple Line Match With Replace Without Regexp?

Aug 13, 2010

how can I do a multiple replaces without using regexp? Right now I just have a while that keeps checking if it exist, then if it does, replacing it. Not very efficient.

View 14 Replies View Related

Regexp / What Does This Match?

Jul 1, 2010

Can someone please let me know what this matches - i can work out some but not all code...

View 3 Replies View Related

Trying To Match A Newline With A Regexp.

Aug 6, 2009

Trying to match a string containing a newline, among other things.

View 4 Replies View Related

RegExp - Just Match The Part Before The <a

Sep 22, 2011

I have this string: this is my test <a href="yay.html">yay</a> and want to just match the part before the <a...: this is my test I can't figure out the regular expression for this. I've tried everything I can think of. It seems that it needs to do a non-greedy search on the first < it finds, but nothing works, like: ((.*<)?)

View 2 Replies View Related

RegExp: How To Match On Exact String Only?

Jul 23, 2005

I am trying to figure out how to set up my reg exp search so that the search
will only match on the exact word.

Here is the current problem code:

Word1 = "RealPlayer.exe"
Word2 = "Player.exe"

RegExp re = Word2;
if (re.Find(Word1))
{
bFound = TRUE;
}

Currently the bFound is set to TRUE since "Player.exe" is found within
"RealPlayer.exe". But I only want bFound to be TRUE is if the entire word
matches.

View 6 Replies View Related

RegExp: Get A Match When A String Is NOT Found

Sep 25, 2006

I need a regexp function which makes a match when the string contains <img...AND the img tag above dows NOT contain a certain path Here is what I have:

<imgs.*(src).+>

This matches if my string contains "<img .....src.....>" (the dots can be anything, I dont care). However, after the "src" part and before the ....

View 2 Replies View Related

Regexp - Replace Part Of Match

Feb 5, 2006

this will match any instance of a number following a letter/[a-z][0-9]/gmiso thatvar str="abc123 456";alert(str.replace(/[a-z][0-9]/gmi,''));would return "ab23 456".

how would i replace just the number? so as to get back "abc23 456" - or ideally "abc 456" ?

View 1 Replies View Related

RegExp Match Returns An Array Of Length 2?

Jan 11, 2010

why I get an array containing [xml, xml]

Code:
str = 'index.xml'
re = RegExp( /([^s./]+)$/ ) ;
str.match(re) // -> [xml, xml]

I only need xml, not an array, and especially not [xml, xml]

Update: thnx mrhoo, thats clear now!

View 1 Replies View Related

Regexp - Negative Match For Fixed String (vs. A Char List)?

Mar 28, 2007

Is there a way in a regexp to *not* match a fixed string value?

Using [^blah] gives matches to anything not containing *any* of letters
b,l,a and h. Whereas I want to match anything that does not containing
the exact string 'blah', i.e. *all* the letters.

Possible?

View 4 Replies View Related

Diving Into Regexp By Porting A Perl Script Over To Js That Uses Regexp To Compress Into A Bookmarklet Capable Format?

Aug 10, 2010

I'm finally diving into regexp by porting a perl script over to js that uses regexp to compress javascript into a bookmarklet capable format.I've successfully worked out 90% of the expressions but am troubled with a few, this one at the moment is odd:I want to remove the first line if it hasjavascript:So I thought str.replace(/^javascripts+:s+/, "") would be ok. I want javascript text, any space, colon, any space and new line. what I'm doing wrong.btw this is the original perl version

$src =~ s{^// ?javascript.+:.+
}{};

View 3 Replies View Related

Using Substrings To Write To A Table Or Grid?

Oct 3, 2011

Basically all I'm trying to do is use substrings to write one random letter of the alphabet into a 2x4 or 4x2 grid or table.

I want to keep the code I have, as I'll need to do more with it later. Again, all I get 8 defined boxes each with one letter in each. I don't want to have any of the existing code changed

Code:
<html>
<head>
<script type="text/javascript">
var pairs;

[Code]....

View 4 Replies View Related

RegExp.input, RegExp.leftContext, ...

Jan 19, 2007

I found this in felgall's page. I added script tag

<script type="text/javascript">

var re = /(t)he/g;
var mystring = "Over the moon.";
re.text(mystring);
alert(RegExp.input); // or RegExp.$_
alert(RegExp.leftContext); // or RegExp["$`"]
alert(RegExp.rightContext); // or RegExp["$'"]
alert(RegExp.lastMatch); // or RegExp["$&"]
alert(RegExp.lastParen); // or RegExp["$+"]
alert(re.source);

</script>

I don't see message box. Please tell me what I can do.

View 3 Replies View Related

Recording High Scores

Feb 13, 2007

I have a team website that has several games for entertainment. One
of the games is a javascript version of yahtzee. Can someone suggest
a way, using javascript, to record a high score for the game instead
of a high score for a particular user, session, or computer. Perhaps
someone already has code written to do this.

View 2 Replies View Related

Recording The Id Of A Input-text If A Particular Key Is Pressed

Aug 2, 2010

I need a javascript that could record the ID/name of a textbox when the user hit delete or backspace to be used on the next page after submission in a PHP script.

There are 96 text boxes, they are all randomly placed on the screen with a question that came from a randomized array's keys (the script later checks the values of the textboxes with the values from the array's keys that correlate to the textboxes by the name/id of the textbox, which is assigned by a for loop that issues the next($array) to assign everything everywhere.

At the same time, it needs to count how many times the backspace/delete were pushed and have that recorded and sent as well.

After 45 minutes of research I've been able to solve the "count the backspace/delete key" problem:

<script type="text/javascript">
var count = 0;
document.onkeypress=function(e){
var e=window.event || e

[Code]....

But onto the name/id issue: I'm not sure how to go about retrieving the names/id of the textboxes. I would assume a onkeypress event for every textbox, but hope that there could be something I could just add to this code.

View 1 Replies View Related

AJAX/PHP Search Script - Recording Searches

Nov 16, 2006

Somebody enters the search term, presses search, and the results are displayed, what is more I record the search term in the DB - plus the number of results returned - reason I want to know what people are searching for and how often - to see if I can plug some holes in product inventory. Anway fairly standard.

Now I also have an AJAX search box (well same box actually) as they type matching products are displayed in a DHTML drop down (like google suggest) - this all works, however I am stuck trying to work out how I could record in the DB what they are searching for in the AJAX search etc as there is no hard action - such as pressing "search", each keystroke is a new search, and I guess I don't really want to be recording like (or do I?):

h 1000 (product matches)
ha 300
har 100
harr 20
harry 10
harry p 6
.......

etc

any ideas as to a possible work around.

View 10 Replies View Related

Recording The Time A Visitor Leaves A Page

May 2, 2010

I have a .Net website that uses a text file to record when visitors arrive on a page.

However, I really want it to also store the date and time that a visitor leaves a page. I can easily calculate the time spent on pages within a session but currently have no way of knowing how long someone spent on the last page they visited during a session.

What I need is a script that runs when a page is unloaded. The script will update a text file (stored in the htdocs folder of the site) with the current time.

So far, I have come to the conclusion that I may need to use JavaScript and the window.onbeforeunload event but I cannot get any further.

View 3 Replies View Related

Google Voice Search And Automatic Recording Input

Mar 28, 2011

I'm using google voice search on a simple form:

Code:

How to activate the voice search, that is generally activated by clicking on the little microphone near the textbox, without clicking it?

I want it to start recording the voice after the user starts talking, or alternatively, after a tot # of seconds..

I did not find anything on the API: [url]

View 1 Replies View Related

Swap The DOM Node Positions?

Mar 31, 2010

I'm attempting to make it so it physically swaps the element position within DOM (the index, in other words) when someone clicks on a button. It will either be the element right before, or right after (depending on which button they click). I'm using jQuery, so if there is an easy way to do it using that, please let me know. If not, I can use jQuery to get the DOM elements using .get(). I don't know if I can just just do something like:

Code:

var domElements = $('.draggable').get();
var tempElement = domElements[index + 1].cloneNode(true);
domElements[index + 1] = domElements[index].cloneNode(true);
domElements[index] = tempElement;

It doesn't seem to work quite right. Should I use replaceChild or something? Don't know if it would work, here? I will know the index, so that's not an issue, here, it's just a matter of getting it to reorder the elements, so when I loop through them, they are processed in the correct order.

View 2 Replies View Related

Incorrect Values Of Element Positions

Oct 30, 2009

I'm developing a chess game recorder (records chess games just like electronic score sheet) and i am trying to write a function that handles the "en passent" rule in chess. However, when i try to test to see if a Black pawn is at a particular x,y location, it is always giving me back "50px". Even when it's not at that location. i uploaded semi-live version to my website here: [URL] you just click on the 'Play' button to start the game here's the function in question:

[Code]..

View 4 Replies View Related

Can't View Rows Of Two Table With The Same Positions

Dec 10, 2010

I have a javascript or CSS problem with two tables with same positions. The two tables has the same structure and positon in page.I want to view the odd lines from a table and the even lines from the oher table. What I have do is the following :

Code:
<style type="text/css">
#slideshow{
background:url('templates/images/femeielaptop.jpg');
width:666px;

[Code]....

After page loads I see just the tabel having id='slideshow'.I have expected to see odd lines from the "slideshow2" table and even lines from the "slideshow" table.

View 1 Replies View Related

Interferences With Scrollbars EX: Sizes, Placements, Positions

Nov 17, 2007

Interferences with scrollbars:

What would effect a scrollbar in a browser on a website?

Let me clear that up. While writing a "rain effect" script, what could interfere with the scrollbar actually not showing up on that specific webpage.

Below is the script I am working with - If in any instance someone may need to review a certain area of it. Code:

View 1 Replies View Related

JQuery :: Reset To The Original Positions Of A Sortable List?

Nov 14, 2008

I'm using this sortable method: [URL] Works perfect! I have one question though: When a certain action is taken by the user, I want to reset the original order of the <li>s in the list. I can't seem to figure out how to do that.

View 3 Replies View Related

JQuery :: List Elements, Swap, Changing Positions?

Mar 31, 2010

in a list, as seen below, i would like to first of all change the order only by clicking a button.e.g. li_elem2 and li_elem3 should change their order (positions), maybe even in a nice animated way later on...i tried to change it by editing the css properties, but didn't work out. so now i would be happy about any other approach i can take to swap items, or change positions of two list items....

<ul class="rounded">
<li class="li_elem1">Liste 1</li>
<li class="li_elem2">Liste 2</li>

[code]....

View 1 Replies View Related

Passing X,Y Positions Of Draggable Layers To INPUT Boxes?

Aug 20, 2001

I have a page where you can dress someone up in silly clothes using a skeleton image, and several items of clothing as gifs in dragable layers. Code:

How can I use a bit of j'script to grab the X and Y values of each layer and then put them in to a load of hidden form fields?

I then intend on having the user click the submit button when they've put all the stupid clothes in the wrong places... and saving the results in a database.

View 1 Replies View Related

Using Draggable Positions - Add Values To Two Hidden Input Elements In The Page

Nov 20, 2011

I have a webpage which the user can drag a marker around inside a div and the script then shows the standard js alert box with the final positions of the marker once the user has stopped dragging it about. What I need to do is get the script to add these values to two hidden input elements in the page.

[Code]...

View 3 Replies View Related







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