I know that I can do like ^= to see if an id starts with something, and I tried using that for this, but it didn't work... Basically, I'm retrieving the url and I want to set a class for an element for pathnames that start in a certain way...
So,
var pathname = window.location.pathname; //gives me /sub/1/train/yonks/459087
I want...
I have a predefined array of rgb values. I want to be able to compare a user defined color to my array and return the closest match in Objective C.
Any help is greatly appreciated.
...
Hi, if i have a string of text like below, how can i collect the contents of the brackets in a collection in c# even if it goes over line breaks?
eg...
string s = "test [4df] test [5yu] test [6nf]";
should give me..
collection[0] = 4df
collection[1] = 5yu
collection[2] = 6nf
...
How do I use case class matching with aliased types? This works when I pull CB etc out of Container.
class DoStuff[TKey](
val c : Container[TKey]#CB
)
{
type CB = Container[TKey]#CB
type C1 = Container[TKey]#C1
type C2 = Container[TKey]#C2
c match {
case C1(e1) => e1 // - not found: value e1 - not found: value C1
...
I get the following error in diff with a red squiggle under Subset.
Type mismatch. Expecting a Range -> Choice but given a Range * Range -> Choice
Is there some sort of type annotation I can add to the SubSet match so I don't have to use fst and snd? If not is there any intention to support this syntax?
type Range = {min : int64; max ...
Hi, Im having trouble matching the format of a string, the format is that of the .srt timing which is "00:00:01,000 --> 00:00:04,000", hour,minutes,seconds,mili seconds.
how do I match this in a string?
Im trying to add and subtract the time here.
...
What's the shortest regex that can match non-zero floating point numbers with any number of decimal places?
It should accept numbers like
-1
-5.9652
-7.00002
-0.8
-0.0500
-0.58000
0.01
0.000005
0.9900
5
7.5
7.005
but reject constructions such as
.
.02
-.
-.996
0
-0
0.
-0.
-0.000
0.00
--
..
+
+0
+1
+.
+1.26
,etc
I do not need suppo...
I want to split a string that can look like this: word1;word2;word3,word4,word5,word6.word7. etc.
The string is from an output that I get from a php page that collects data from a database so the string may look different but the first words are always separated with ; and then , and the last words with .(dot)
I want to be able to fet...
Hello,
I am writing a function to get overall score in SQL
What I have is;
out of 20 points I got 12.4 points
so if I transform that, to take percentage over 100% how would I do it?
Thanx,
Adnan
...
Recently, I found one C# Regex API really annoying.
I have regular expression "(([0-9]+)|([a-z]+))+". I want to find all matched string. The code is like below.
string regularExp = "(([0-9]+)|([a-z]+))+";
string str = "abc123xyz456defFOO";
Match match = Regex.Match(str, regularExp, RegexOptions.None);
i...
Basically, if I'm at: http://example.com/content/connect/152, I want to find out if "connect" is present in the url and then set the selected value of a menu to something specific... (The url could also be something like http://example.com/content/connections, in which case, it should still match...)
This is what I've been trying, whic...
I've already looked at this, which was helpful to a point.
Here's the problem. I have a list of users propagated into an element via user click; something like this:
<div id="box">
joe-user
page-joe-user
someone-else
page-someone-else
</div>
On click, I want to make sure that the user has not already been clicked into...
Hello,
It's probably something really simple, but I'm just learning.
There's a page with 3 blockquote tags on it, and I'd need to get the innerHTML of the one containing a certain string. I don't know how to search/match a string and get the innerHTML of the tag containing the matched result.
Any help would be appreciated for this new...
Hello!
i really like Regex, unfortantly Im not that good at it yet. So therfore I hope you guys can help me out.
The text string I want to validate consists of what I call "segments". A single segment might look like this:
[A-Z,S,3]
So far I managed to build this regex pattern
(?:\[(?<segment>[^,\]\[}' ]+?,[S|D],\d{1})\])+?
it w...
How can I use a regular expression to match text that is between two strings, where those two strings are themselves enclosed two other strings, with any amount of text between the inner and outer enclosing strings?
For example, I have this text:
outer-start some text inner-start text-that-i-want inner-end some more text outer-end
...
Good day,
Given a document {'foo', 'bar', 'baz'}, I want to match using SpanNearQuery with the tokens {'baz', 'extra'}
But this fails.
How do I go around this?
Thanks,
Franz
Sample test (using lucene 2.9.1) with the following results:
givenSingleMatch - PASS
givenTwoMatches - PASS
givenThreeMatches - PASS
givenSingleMatch_andExtra...
I am trying to find out all occurences of my concrete word (method call with deprecated API) in all files in a directory. I need a regexp to find all such occurences which do not contain updated call (new API). Can you help me please?
Example:
deprecated api: method(a,b,c)
new api: method({a:a, b:b, c:c})
The regexp should find all ...
If you have an array with six numbers, say:
public var check:Array = new Array[10,12,5,11,9,4];
or
public var check:Array = new Array[10,10,5,11,9,4];
How do you check for a match (of a pair?)
...
I have the following function but despite using the break statement, it doesn't seem to be stopping after it finds a match in the array:
private function CheckMatch() {
// _playersList is the Array that is being looped through to find a match
var i:int;
var j:int;
for (i= 0; i < _playersList.length...
I need to find and algorithm to find the best matches in a social network. The system is a college student social network, and basically the main idea is to find a study partner for a class. The idea it's to suggest to the user what are the potential best partners based on different criteria, such as common class, GPA, rating, common sch...