Hello,
I'm looking for a library that could perform "easy" pattern matching, a kind of pattern that can be exposed via GUI to users.
It should define a simple matching syntax like * matches any char and alike.
In other words, I want to do glob (globbing) like sun's implemented logic http://openjdk.java.net/projects/nio/javadoc/java/n...
Hi all,
Mac OS 10.6, Cocoa project, 10.4 compatibility required.
(Please note: my knowledge of regex is quite slight)
I need to parse NSStrings, for matching cases where the string contains an embedded tag, where the tag format is:
[xxxx]
Where xxxx are random characters.
e.g. "The quick brown [foxy] fox likes sox".
In the ab...
mv command doesnt accept pattern matching like grep !
Whats the good way to handle this and similar kind of operations ?
...
I want to match one of the following two lists in Racket (formerly PLT Scheme):
'(somename : (_ptr o sometype))
or
'(somename : (_ptr io sometype))
As you can see, the only difference is the literals 'o and 'io in the embedded list.
I can see two basic ways to do this.
Either:
(match myexpr
[(list name ': (list '_ptr 'o _)) ...
I want to filter out duplicate customer names from a database.A single customer may have more that one entry to the system with the same name but with little difference in spelling. So here is an example: A customer named Brook may have three entries to the system
with this variations:
Brook Berta
Bruck Berta
Biruk Berta
let's assum...
I am trying to use sql pattern matching to check if a string value is in the correct format.
The string code should have the correct format of:
alphanumericvalue.alphanumericvalue
Therefore, the following are valid codes:
D0030.2190
C0052.1925
A0025.2013
And the following are invalid codes:
D0030
.2190
C0052.
A0025.2013.
A0025.201...
There is a database with N fixed length strings.
There is a query string of the same length.
The problem is to fetch first k strings from the database that have the smallest Hamming distance to q.
N is small (about 400), strings are long, fixed in length. Database doesn't change, so we can pre-compute indexes. Queries vary strongly, cac...
I have xml that looks like this:
val xml =
<plugins>
<plugin type="x">plugin x</plugin>
<plugin type="y">plugin y</plugin>
</plugins>
I am trying to write a match statement that finds the plugin with the attribute type="x". I tried:
xml match {
case <plugin type="x">{contents}</plugin> => println(contents)
case _ => println(...
Hello, I'm having a problem in fixing a warning that OCaml compiler gives to me.
Basically I'm parsing an expression that can be composed by Bool, Int and Float.
I have a symbol table that tracks all the symbols declared with their type:
type ast_type = Bool | Int | Float
and variables = (string, int*ast_type) Hashtbl.t;
where int i...
Hi,
I am trying to use regular expressions to determine what format the user have applied when entering input in a textbox.
The regular expressions are as follows:
(\\s?[" + alphabet + "]{9,9})+
To determine whether the input is one or more strings of length 9 in a given alphabet, possibly separated by whitespace.
(>[\\w\\s]+\\n[" +...
Here's the python list of strings:
patterns = [
"KBKKB",
"BBBK",
"BKB",
"KBBB",
"KBB",
"BKBB",
"BBKB",
"KKBKB",
"BKBK",
"KBKB",
"KBKBK",
"BBK",
"BB",
"BKKB",
"BBB",
"KBBK",
"BKKBK",
"KB",
"KBKBK",
"KKBKKB",
"KBK",
"BBKBK",
"BBBB",
"BK",
"KKBKBK",
"KBBKB",
"BBKKB",
"KKKKBB",
"KKB"
]
I have an input string that consist of K and B only of...
Hi can any one tell me why there we are not using Knuth Morris Pratt algorithms in modern programming practices and prefer regular expression more ?
...
I have a case class
case class ~[a,b](_1:a, _2:b)
When I want to do pattetn matching
new ~("a", 25) match{
case "a" ~ 25 =>
}
I can use it this way because "a" ~ 25 and ~("a", 25) are equivalent. But if I want to match new ~("a", new ~("b", 25)) by {case "a" ~ "b" ~ 25 => } troubles begin. I understand that this statements aren't...
I am searching for a table recognition library which can operate on plain text.
Ideally the library is not a dirty hack of regular expression, but something inference-based.
All I can find are papers but no implementations of the concepts described. I am willing to implement such a concept, but I can not believe there is nothing out the...
parserChar :: Char -> Parser Char
parserChar c = Parser ch where
ch d = case dvChar d of
Parsed c dp -> Parsed c dp
_ -> NoParse
The above function is supposed to take a Char c and return a Parser which will only match c. The function dvChar d is going to return either Parsed char dp or NoParse (where char is the next ch...
Is it possible to use pattern matching over specified functions directly or with some exploits that don't involve specifying a type for every function I need?
Just to explain things better suppose I have a type like
type BBoolOp = (bool->bool->bool)*term*term
and suppose that the bool->bool->bool functions are some quite simple like ...
Hello,
I have a Request class that can be in one of the following states:
Draft,
Submitted,
Approved,
Rejected,
InMission,
Completed
The state of the Request object can be changed by calling one of the following methods. Each method may include some arguments to further associate some data with a particular state:
void Submit(...
I'm changing some Haskell code from using lists to sets. I understand everything required, I think, but I'm not sure how to pattern match on sets. Lists have this nice literal syntax that seems hard to emulate with the Set constructor. For example, I might have some code like this:
foo [] = []
foo x = other_thing
How can I write this ...
How would I convert this to C# from VB.net. I tried the online converters but I got errors when I put it in my project.
Dim regexinfo As String = String.Empty
Dim p = "\[news\](?<info>.*?)\[/news\]"
Dim Matches = Regex.Matches(response, p, RegexOptions.IgnoreCase Or RegexOptions.Singleline)
If Matches IsNot Nothing AndAlso Matches.Count...
I still get a little confused when it comes to selectors and patterns... Basically, I'm trying to find the parent div of an input item and if a string is found anywhere in its ID, I want to set it to display none.
I've done this before by just doing something like:
if($('div[id*=string]')) { $(this).attr('display','none'); }
But,...