Hi All I am a newcomer here,
I am using the following code from an open source library (Matrix Toolkits for Java) which outputs the following matrix
1000 1000 5
3 5 1.000000000000e+00
I am trying to do a String split that will return me 1000,1000,5
I tried using String[] parts = str.trim()...
I have a regex where
%word% can occur multiple times, separated by a "<"
%word% is defined as ".*?"|[a-zA-Z]+
so i wrote
(".*"|[a-zA-Z]+)([<](".*"|[a-zA-Z]+))*
Is there any way i can shrink it using capturing groups?
(".*"|[a-zA-Z]+)([<]\1)*,
But i don't think \1 can be used as it'd mean repeat the first capture, as i would not ...
$content = preg_match('/[flv[^/]]+:(.*?)[^/]]*/]','', $content);
Could someone give me the regular expression for extracting [flv:example.flv 465 301] from a string. Also, I would like to put the example.flv into second element of the array, and the dimensions in to the third element. I have tried the above regex and it fails miserably...
I'm learning regex and need some help to get all possible matches for a pattern out of a string.
If my input is:
case a
when cond1
then stmt1;
when cond2
then stmt2;
end case;
I need to get the matches which have groups as follows
Group1:
"cond1"
"stmt1;"
and Group2:
"cond2"
"stmt2;"
Is it possible to get such groups using...
I want to be able to write a function which receives a number in scientific notation as a string and splits out of it the coefficient and the exponent as separate items. I could just use a regular expression, but the incoming number may not be normalised and I'd prefer to be able to normalise and then break the parts out.
A colleague ha...
I have a path as a string in a shell-script, could be absolute or relative:
/usr/userName/config.cfg
or
../config.cfg
I want to extract the file name (part after the last /, so in this case: "config.cfg")
I figure the best way to do this is with some simple regex?
Is this correct? Should or should I use sed or awk instead?
Shell...
I need to find names which contain three number 7 in the random order.
My attempt
We need to find first names which do not contain seven
ls | grep [^7]
Then, we could remove these matches from the whole space
ls [remove] ls | grep [^7]
The problem in my pseudo-code starts to repeat itself quickly.
How can you find the names whic...
Hi,
I need to remove commas within a String only when enclosed by quotes.
example:
String a = "123, \"Anders, Jr.\", John, [email protected],A"
after replacement should be
String a = "123, Anders Jr., John, [email protected],A"
Can you please give me sample java code to do this?
Thanks much,
Lina
...
Hi,
I use regex buddy which takes in a regex and then gives out the meaning of it from which one gets what it could be doing? On similar lines is it possible to have some engine which takes natural language input describing about the pattern one needs to match/replace and gives out the correct(almost correct) regex for that description?...
My log files contain the following:
2009-03-12T12:44:27+0000 something was logged
2009-03-12T12:45:36+0000 127.0.0.1 127.0.0.1 <auth.info> last message repeated 2 times
I can write a regular expression that retrieves the line with the "last message repeated..." statement, however, that line is meaningless without also retrieving the...
I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example:
filename = "Example_file_(extra_descriptor).ext"
and I want to regex a whole bunch of files where the parenthetical expression might be in the middle or ...
I am trying to clean up some data, and I would eventually like to put it in CSV form.
I have used some regular expressions to clean it up, but I'm stuck on one step.
I would like to replace all but every third newline (\n) with a comma.
The data looks like this.
field1
field2
field3
field1
field2
field3
etc..
I need it in
field1,...
Assume a table titled 'transactions'
Typical query: select * from transactions where ip=INET_ATON('127.0.0.1');
I want the ability to do a regex search for all ip's with a particular first octet (i.e. 127) but I can't quite figure out the syntax.
Thanks!
...
Hi,
I use one WYSIWYG editor in a small cms. It allows users to upload files, images, etc. If I add image named dog.jpg, in source I'll get:
<img src="/myweb/userfiles/images/dog.jpg" />
I can save this to a database and use it later on any page, until I move my site to a live domain.
myweb is virtual directory in IIS. "/" points to ...
Is there a way to achieve the equivalent of a negative lookbehind in javascript regular expressions? I need to match a string that does not start with a specific set of characters.
It seems I am unable to find a regex that does this without failing if the matched part is found at the beginning of the string. Negative lookbehinds seem ...
Hi,
I would like to get all occurrences of [0-9A-Z]+? for processing later.
I do have
if [[ `cat file` =~ '[0-9A-Z]+?' ]]; then
echo $BASH_REMATCH;
fi
Which gives me first match, but how could I process all the matches in the file?
Thank you
...
I have an address class that uses a regular expression to parse the house number, street name, and street type from the first line of an address. This code is generally working well, but I'm posting here to share with the community and to see if anyone has suggestions for improvement.
Note: The STREETTYPES and QUADRANT constants conta...
I need some help with regex.
i want to get the string which has a delimiter in it between two specific words.
e.g.
i need a regex which matches:
Statements1 start Statements2 ; Statements3 end fun;
There can be multiple occurences of ' ; ' between 'start' and 'end'.
Statements are multiple words where (.*) can be used in the regex f...
Hello,
I want to parse a file and I want to use php and regex to strip:
blank or empty lines
single line comments
multi line comments
basically I want to remove any line containing
/* text */
or multi line comments
/***
some
text
*****/
If possible, another regex to check if the line is empty (Remove blank lines)
Is that pos...
I am converting some matlab code to C, currently I have some lines that have powers using the ^, which is rather easy to do with something along the lines \(?(\w*)\)?\^\(?(\w*)\)?
works fine for converting (glambda)^(galpha),using the sub routine in python pattern.sub(pow(\g<1>,\g<2>),'(glambda)^(galpha)')
My problem comes with nested ...