I have an expression that gives a matrix and I want to access an element, without creating a temporary variable, something like this cov(M)(1,1). How can I do it?
Thanks!
I'm looking for some regular expression to help parse my CSV file.
The file has lines of
number,number
number,number
Comment I want to skip
number,number
number,number
Ex:
319,5446
564425,87
Text to skip
27,765564
I read each line into a string and I wanted to use some regular express to make sure the line matches the pattern of (number,number). If not then don't use the line.
Hello,
I need a regular expression to parse a text, the text is a URL. The URL is
http://www.foo.com/bar/hello.txt.
I want to get rid of the hello.txt, the delimiter is the slash.
I would like to get http://www.foo.com/bar/
I'm trying to figure out the regular expression that will match any character that is not a letter or a number. So characters such as (,,@,£,() etc ...
Once found I want to replace it with a blank space.
Any advice.
I have this situation(Java code):
1) a string such as : "A wild adventure" should match.
2) a string with adjacent repeated words: "A wild wild adventure" shouldn't match.
With this regular expression: .* \b(\w+)\b\s*\1\b.* i can match strings containing adjacent repeated words.
How to reverse the situation i.e how to match strings which do not contain adjacent repeat words
Imagine I have the following:
inFile = "/adda/adas/sdas/hello.txt"
# that instruction give me hello.txt
Name = inFile.name.split("/") [-1]
# that one give me the name I want - just hello
Name1 = Name.split(".") [0]
Is there any chance to simplify that doing the same job in just one expression?
Hello,
I have a simple problem on .xhtml page. This expression is not working :-
<a href="Photos.jsf?albumId=#{item.albumId}&blogId=#{PhotoAlbumsCommonBean.blogId}">
photos
</a>
I get this error :-
Error Parsing /Common/PhotoAlbums.xhtml: Error Traced[line: 20] The reference to entity "blogId" must end with the ';' delimiter.
& is causing some kind of error. Thanks in advance :)
Ok, this is a really weird one.
I have an MPI program, where each process has to generate random numbers in a fixed range (the range is read from file). What happens is that even though I seed each process with a different value, and the numbers generated by rand() are different in each process, the expression to generate the random numbers still yields the same sequence between them.
Here's all relevant code:
// 'rank' will be unique for each process
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
// seed the RNG with a different value for each process
srand(time(NULL) + rank);
// print some random numbers to see if we get a unique sequence in each process
// 'log' is a uniquely named file, each process has its own
log << rand() << " " << rand() << " " << rand() << std::endl;
// do boring deterministic stuff
while (true)
{
// waitTimeMin and waitTimeMax are integers, Max is always greater than Min
waitSecs = waitTimeMin + rand() % (waitTimeMax - waitTimeMin);
log << "waiting " << waitSecs << " seconds" << std::endl;
sleep(waitSecs);
// do more boring deterministic stuff
}
Here's the output of each process, with 3 processes generating numbers in the range [1,9].
process 1:
15190 28284 3149
waiting 6 seconds
waiting 8 seconds
waiting 9 seconds
waiting 4 seconds
process 2:
286 6264 3153
waiting 6 seconds
waiting 8 seconds
waiting 9 seconds
waiting 4 seconds
process 3:
18151 17013 3156
waiting 6 seconds
waiting 8 seconds
waiting 9 seconds
waiting 4 seconds
So while rand() clearly generates different numbers, the expression to calculate waitSecs still evaluates to the same sequence on all processes. What's even weirder: if I run the program with the same parameteres again, only the first 3 random numbers will change, the rest of the "random" sequence will be exactly the same in each run! Changing the range of numbers will obviously produce a different result from this one, but the same parameters always yield the same sequence, between processes and between executions: except for the first 3 numbers.
Just what the hell is going on here?
Hi,
i need to check a string that should contain only ABCDEFG characters, in any sequence and with only 7 characters. Please let me know the correct way of using regular expression.
as corrently i am using
String abs = "ABPID";
if(!Pattern.matches("[[ABCDEFG]", abs))
System.out.println("Error");
i am using the following code which works when i use the String abcdefg but for other cases it fails. please help me out.
Just tired to see this error every time for years only in ONE project: "Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible, possibly because the code is optimized"
Almost every property or field displays this message. From vs2005+.net2.0 to vs2008+.net3.5 now. Does anybody know how to fix it?
the following code
Dim dc = New DataColumn(name, GetType(Double), "[col1] ^ [col2]")
produces the following error:
The expression contains unsupported operator '^'.
Is this right, is the power operand not support in datacolumn expressions???
Anyone have an idea how i'd write this?
I'm trying to use regular expression to extract the comments in the heading of a file.
For example, the source code may look like:
//This is an example file.
//Please help me.
#include "test.h"
int main() //main function
{
...
}
What I want to extract from the code are the first two lines, i.e.
//This is an example file.
//Please help me.
Any idea?
Can some one help me create a regular expression in C#.net to add target="_blank" to all tag links in my content? If the link already has a target set then replace it with "_blank". The purpose is to open all links in my content in a new window.
Appreciate your help
-dotnet rocks
I have a string something like this:
"2014-01-23 09:13:45|\"10002112|TR0859657|25-DEC-2013>0000000000000001\"|10002112"
I would like to split by pipe apart from anything wrapped in double quotes so I have something like (similar to how csv is done):
[0] => 2014-01-23 09:13:45
[1] => 10002112|TR0859657|25-DEC-2013>0000000000000001
[2] => 10002112
I would like to know if there is a regular expression that can do this?
text = text.replace(/\.(?=[a-zA-Z0-9\[])/g, "<span style='background-color: #FF00FF'>.</span>");
I want to use javascript to highlight all full stops that is followed by letters, numbers and [. The above expression works for letters and numbers, but not bracket. Any idea what's wrong?
I know you can generate all permutations from a list, using glob or Algorithm::Permute for example - but how do you generate all possible permutations from a regular expression?
i want to do like:
@perms = permute( "/\s[A-Z][0-9][0-9]/" );
sub permute( $regex ) {
# code - put all permutations of above regex in a list
return @list;
}
Which regular expression can I use to match (allow) any kind of letter from any language
I need to match any letter including any diacritics (e.g. á, ü, ñ, etc.)
and exlude any kind of symbol (math symbols, currency signs, dingbats, box-drawing characters, etc.) and punctuation characters.
I've tried using
\p{L}\p{M}*
but it doesn't work.
Hi ,
I am finding Email ids in mu project, where I am preprocessing the input using some Regular Expression.
RegExpPhone6.RegComp("[\[\{\(][ -]?[s][h][i][f][t][ -]?[+-][2][ -]?[\]\}\)]");
Here while I am compiling i am getting a warning msg like
Warning 39 warning C4129: ')' : unrecognized character escape sequence
How can i resolve this ?
Why this is occuring and Where will it affect?
Kindly help me...
I got a headache looking for this:
How do you use s/// in an expression as opposed to an assignment. To clarify what I mean, I'm looking for a perl equivalent of python's re.sub(...) when used in the following context:
newstring = re.sub('ab', 'cd', oldstring)
The only way I know how to do this in perl so far is:
$oldstring =~ s/ab/cd/;
$newstring = $oldstring;
Note the extra assignment.
The lack of expression trees in Compact Framework has bugged me for some time now, but I haven't really looked for a solution.
Today, I've found a blog post about an alternative System.Linq.Expressions built on top of Mono System.Core and used e.g. by db4o (you can find it here).
My question is - have you used this library and if so, what were your experiences with it (especially regarding performance)?
For the love of God I am not getting this easy code to work! It is always alerting out "null" which means that the string does not match the expression.
var pattern = "^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$";
function isEmailAddress(str) {
str = "[email protected]";
alert(str.match(pattern));
return str.match(pattern);
}
I am trying to match an expression of type
field:"value"
but not
field:value
I have written
([a-z]+)\s*?:\s*?"(.+)"\s*?
and this works excepts in dotNet
Is there any reason why this might be? Something I am missing?
Hi all,
Please could someone help me, i will be forever appreciative.
I'm trying to create a regular expression which will extract 797 from "Your job 797 ("job_name") has been submitted"
or "Your Job 9212 ("another_job_name") has been submitted" etc.
Any ideas? Thanks guys!
Basically I want to strip the document of words between blockquotes. I'm a regular expression newb and even after using rubular, I'm no closer to the answer.
Any help is appreciated.
I'm working on a new Java project and therefore im reading the already existing code. On a very important part of the code if found the following regex expression and i can't really tell what they are doing. Anybody can explain in plain english what they do??
1)
[^,]*|.+(,).+
2)
(\()?\d+(?(1)\))