I'm getting started with RegEx and I was wondering if anyone could help me craft a statement to convert coordinates as follows:
145.00694,-37.80421,9 145.00686,-37.80382,9 145.00595,-37.8035,16 145.00586,-37.80301,16
to
145.00694,-37.80421
145.00686,-37.80382
145.00595,-37.8035
145.00586,-37.80301
(Strip off the last comma and val...
I am close but I am not sure what to do with the restuling match object. If I do
p = re.search('[/@.* /]', str)
I'll get any words that start with @ and end up with a space. This is what I want. However this returns a Match object that I dont' know what to do with. What's the most computationally efficient way of finding and returnin...
I want to break a Python string into its characters.
sequenceOfAlphabets = list( string.uppercase )
works.
However, why does not
sequenceOfAlphabets = re.split( '.', string.uppercase )
work?
All I get are empty, albeit expected count of elements
...
Is there any difference in speed/memory usage for these two equivalent expressions:
Regex.IsMatch(Message, "1000")
Vs
Message.Contains("1000")
Any situations where one is better than other ?
The context of this question is as follows:
I was making some changes to legacy code which contained the Regex expression to find whether a s...
Simple example: we have string "Some sample string Of Text". And I want to filter out all stop words (i.e. "some" and "of") but I don't want to change letter case of other words which should be retained.
If letter case was unimportant I would do this:
str.toLowerCase().replaceAll ("a|the|of|some|any", "");
Is there an "ignore case" ...
Hi all, I try explain my issue:
note 1: I have only strings, not files, ONLY strings.
I have a string like this (NOTE: I include line numbers for better explain)
The line separator is \r\n (CRLF)
string allText =
1 Lorem ipsum Lorem ipsum
2 == START 001partXXX.sql ==
3 Lorem ipsum TEXT Lorem ipsum
4 == END 001partXXX.sql ==
5 L...
I have this as a sql statement. What does it do
IF(`table`.`field1` IS NULL,
'',
GROUP_CONCAT(DISTINCT `table`.`field1` ASC SEPARATOR ',')
) AS `MyNewFields`,
...
How would you efficiently build a cell array of strings which contain numbers (in my particular case, a cell array of labels for a legend).
Eg:{'series 1', 'series 2', 'series 3'}
I've tried things along the lines of
sprintf('series %i', {1:10})
but apparently sprintf and cell arrays don't play nice together.
Something like this ...
Hi,
This question is already asked/answered by other members but my case is a bit different..
Problem: How to reverse words in a string? You can use strpos(), strlen(), substr() but not other very useful functions such as explode(), strrev() etc.
This is basically an interview question so I need to demonstrate ability to manipulate st...
Is there a cool way to take something like this:
Customer Name - City, State - ID
Bob Whiley - Howesville, TN - 322
Marley Winchester - Old Towne, CA - 5653
and format it to something like this:
Customer Name - City, State - ID
Bob Whiley - Howesville, TN - 322
Marley Winchester - Old Towne, CA - 5653
Using ...
Suppose I've got a custom form label with some HTML on it like so:
SafeUnicode('<span class="superscript">™</span>')
Why would Django 1.2 have a function mark_safe if this exist? What are the differences if any?
Thanks for the help!
...
Title says it all really. Using only XSLT 1.0's string functions, how would I go about slicing off the end of a url?
So from
http://stackoverflow.com/questions/2981175/is-it-possible-to-slice-the-end-of-a-url-with-xslt-1-0
I would like to extract
is-it-possible-to-slice-the-end-of-a-url-with-xslt-1-0
Is this possible?
...
I'm attempting to extract a given pattern within a text file, however, the results are not 100% what I want.
Here's my code:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ParseText1 {
public static void main(String[] args) {
String content = "<p>Yada yada yada <code> foo ddd</code>yada yada ...\n...
Hi all!
I Use this code:
NSString* strName = [NSString stringWithFormat:@"img_00%d.jpg", pp];
and works fine, but if pp took the value of 10 for example I wish have img_010.jpg as result, and not img_0010.jpg...
how can I format the string??
thanks
...
In PHP, I need to be able to figure out if a string contains a URL. If there is a URL, I need to isolate it as another separate string.
For example: "SESAC showin the Love! http://twitpic.com/1uk7fi"
I need to be able to isolate the URL in that string into a new string. At the same time the URL needs to be kept intact in the original ...
Suppose you want to generate dynamic page titles that look like this:
"It was all a dream, I used to read word up magazine" from "Juicy" by The Notorious B.I.G
I.e., "LYRICS" from "SONG_NAME" by ARTIST
However, your title can only be 69 characters total and this template will sometimes generate titles that are longer.
One strategy fo...
We often see websites that display first few lines of an article and then append ... [More] so that people who are interested in can click on it to view the full article.
To implement this functionality, we first need to find out where the article text should be cut to append the ... [More].
Since there must be some HTML/ CSS coupled w...
>>> t1 = "abcd.org.gz"
>>> t1
'abcd.org.gz'
>>> t1.strip("g")
'abcd.org.gz'
>>> t1.strip("gz")
'abcd.org.'
>>> t1.strip(".gz")
'abcd.or'
Why does the 'g' of '.org' is gone?
...
The post office actually publishes a list of commonly used street suffixes in addresses:
http://www.usps.com/ncsc/lookups/abbr_suffix.txt
I want to take this list and make a ruby function that takes a string, takes the last word ("183 main strt".split[' '].last) and if it matches any of the commonly used street suffixes ("strt"), repla...
Hi,
I have a string like this:
"user=u123;name=Test;lastname=User"
I want to get a dictionary for this string like this:
user "u123"
name "Test"
lastname "User"
this way I can easely access the data within the string.
I want to do this in C#.
EDIT:
This is what I have so far:
public static Dictionary<string, string> V...