I want to be able to detect (using regular expressions) if a string contains hebrew characters both utf8 and iso8859-8 in the php programming language. thanks!
how do we pass a string Mr.X & Mr.Y in the URL.
I have tried this but this one does all the chars but ampersand.
[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
Thanks for the help.
take this string as an example: "will see you in London tomorrow and Kent the day after tomorrow".
How would I convert this to an associative array that contains the keywords as keys, whilst preferably missing out the common words, like this:
Array ( [tomorrow] = 2 [London] = 1 [Kent] = 1)
Any help greatly appreciated.
I want to use a variable in a regex, like this:
variables = ['variableA','variableB']
for i in range(len(variables)):
regex = r"'('+variables[i]+')[:|=|\(](-?\d+(?:\.\d+)?)(?:\))?'"
pattern_variable = re.compile(regex)
match = re.search(pattern_variable, line)
The problem is that python adds an extra backslash character for each backslash character in my regex string (ipython), and makes my regex invalid:
In [76]: regex
Out[76]: "'('+variables[i]+')[:|=|\\(](-?\\d+(?:\\.\\d+)?)(?:\\))?'"
Any tips on how I can avoid this?
How convert a string into a ActiveSupport::TimeWithZone? My dilemma is this. I need to update a field (called updated_at). The field in mysql is datetime, and the class is ActiveSupport::TimeWithZone. But the dates are strings like "10/17/2008". I used "10/17/2008".to_date (And I intend .to_time and to_datetime), and even if in console the ActiveRecord class save succesfully, the field in the database still is the current date...
Thanks in advanced.
I am looking for a regex to validate a string. I want to allow numbers, alpha characters, spaces and any of the following characters in any order:
+ - ( ) ,
Thanks.
Hi, I've looked through other questions but i don't think this has been asked before:
I have an email client i'm building in the .NET framework, and would like to automatically create google calendar events (just like in gmail). Is there a way to feed an email message (i.e. a string) and automatically identify if there is a possible event or not in that?
Any ideas?
Thanks, Erika
I want to do a database-side string concatenation in a Rails query, and do it in database-independent way.
SQL-92 specifies double-bar (||) as the concatenation operator. Unfortunately it looks like MS SQL Server doesn't support it; it uses + instead.
I'm guessing that Rails' SQL grammar abstraction has solved the db-specific operator problem already. If it does exist, how do I use it?
Python says I need 4 bytes for a format code of "BH":
struct.error: unpack requires a string argument of length 4
Here is the code, I am putting in 3 bytes as I think is needed:
major, minor = struct.unpack("BH", self.fp.read(3))
"B" = Unsigned char (1 byte) + "H" unsigned short (2 bytes) = 3 bytes (!?)
struct.calcsize("BH") says 4 bytes.
I need to search for lines in a CSV file that end in an unterminated, double-quoted string.
For example:
1,2,a,b,"dog","rabbit
would match whereas
1,2,a,b,"dog","rabbit","cat bird"
1,2,a,b,"dog",rabbit
would not.
I have very limited experience with regular expressions, and the only thing I could think of is something like
"[^"]*$
However, that matches the last quote to the end of the line.
How would this be done?
Hi, We are trying parse the date with timestamp string, it blows up in IE but works fine FireFox.
Here are the code
alert(new Date(Date.parse("2010-01-31T12:00:00.233467-05:00")));
Any idea to make it work in IE browser? Thanks in advance.
I thought this will be trivial but I can't get this to work.
Assume a line in a CSV file:
"Barak Obama", 48, "President", "1600 Penn Ave, Washington DC"
string[] tokens = line.split(',')
I expect this:
"Barak Obama"
48
"President"
"1600 Penn Ave, Washington DC"
but the last token is
'Washington DC' not
"1600 Penn Ave, Washington DC".
Is there an easy way to get the split function to ignore the comma within quotes?
Hi Guys,
I want to append the string into single varilable using stringWithFormat.I knew it in using stringByAppendingString. Please help me to append using stringWithFormat for the below code.
NSString* curl = @"https://invoices?ticket=";
curl = [curl stringByAppendingString:self.ticket];
curl = [curl stringByAppendingString:@"&apikey=bfc9c6ddeea9d75345cd"];
curl = [curl stringByReplacingOccurrencesOfString:@"\n" withString:@""];
Thank You,
Madan Mohan.
Hi All,
I have the following strings in my application.
/admin/stylesheets/11
/admin/javascripts/11
/contactus
what I want to do is to write a regular expression to capture anything other than string starting with 'admin'
basically my regex should capture only
/contactus
by excluding both
/admin/stylesheets/11
/admin/javascripts/11
to capture all i wrote
/.+/
and i wrote /(admin).+/ which captures everything starts with 'admin'. how can i do the reverse. I mean get everything not starting with 'admin'
thanks in advance
cheers
sameera
I fill a DataSet and allow the user to enter a search string. Instead of hitting the database again, I set the RowFilter to display the selected data. When the user enters a square bracket ( "[" ) I get an error "Error in Like Operator". I know there is a list of characters that need prefixed with "\" when they are used in a field name, but how do I prevent RowFilter from interpreting "[" as the beginning of a column name?
hi all , i am trying to read a string from user in TASM assembly , i know i need a buffer to hold the input , max. length and actual length , but i seem to forgot how exactly we declare a buffer
my attempt was smth like this
Buffer db 80 ;max length
db ? ;actual length
db 80 dup(0);i think here is my problem but can't remember the right format
Thanks in advance
I'm currently using the following code to right-trim all the std::strings in my programs:
std::string s;
s.erase(s.find_last_not_of(" \n\r\t")+1);
It works fine, but I wonder if there are some end-cases where it might fail?
Of course, answers with elegant alternatives and also left-trim solution are welcome.
I've got a string:
doCall(valA, valB);
Using a regex in GVIM I would like to change this to:
valA = doCall(valA, valB);
How would I go about doing this? I use %s for basic regex search and replace in GVIM, but this a bit different from my normal usages.
Thanks
Using Authlogic, the time format for @user.last_login_at" looks like this:
Mon Apr 12 16:52:56 -0400 2010
How can I mangle that into a more user friendly string?
Hi,
Is it possible to calculate the bounds of a htmlized String in Java Swing?
I tried using the BasicHtml.createHTMLView, but kept getting the same prefSpan; irrespective of the component font.
Regards,
Pavan
I have a string, 'songchoice'
I want it to become a 'Uri' so I can use with MediaPlayer.create(context, Uri)
Can someone help me to convert songchoice to the Uri?
Thanks,
James