Re: [Rails] regular expression

2012-01-10 Thread Fernando Almeida
Try your regex with online tools, what you need is simple "kausik-(\d+)" http://www.gethifi.com/tools/regex http://regexpal.com/ http://nregex.com/nregex/default.aspx 2012/1/10 Kausik Bakshi > I am very new in javascript > > and I want a regular expression for > > kausik-543678 > > here kau

[Rails] regular expression

2012-01-10 Thread Kausik Bakshi
I am very new in javascript and I want a regular expression for kausik-543678 here kausik- is fixed and the next integer field is dynamic I am trying to form a regular expression for kausik-123456 or kausik-45765677367567 or kausik-64747 please help Thanks in Advance Kausik -- Posted via

Re: [Rails] Regular Expression help

2011-07-21 Thread Fernando Almeida
Very easy :-) (\d+)(\w+)(\d{4})(\d{2})(\d{2} )(\d{2})(\d{2})(\d{2}) Tests... http://www.gethifi.com/tools/regex http://nregex.com/nregex/default.aspx http://regexpal.com/ 2011/7/21 Leonel *.* > I have a string composed of three parts. > 1) a number, could be 1, 2, 3, 4 or more digits. > 2)

Re: [Rails] Regular Expression help

2011-07-21 Thread Curtis Schofield
On Jul 21, 2011, at 3:15 PM, Leonel *.* wrote: > I have a string composed of three parts. > 1) a number, could be 1, 2, 3, 4 or more digits. > 2) the word pending > 3) and then a date in this format: year,month,day,hour,minute,second > > I would like to extract each in a variable. > > Examples:

[Rails] Regular Expression help

2011-07-21 Thread Leonel *.*
I have a string composed of three parts. 1) a number, could be 1, 2, 3, 4 or more digits. 2) the word pending 3) and then a date in this format: year,month,day,hour,minute,second I would like to extract each in a variable. Examples: 7pending20110721170832 504pending20110720110107 -- Posted via

Re: [Rails] Regular expression not working in Rails

2011-02-16 Thread Colin Law
On 16 February 2011 03:41, Rob Biedenharn wrote: > > On Feb 15, 2011, at 10:12 PM, Keith Raymond wrote: > >> I can't figure out why this regexp isn't working in my rails method. >> I've been testing it with the the firefox regular expression tester add >> on and it works there but not in the rails

Re: [Rails] Regular expression not working in Rails

2011-02-15 Thread Rob Biedenharn
On Feb 15, 2011, at 10:12 PM, Keith Raymond wrote: I can't figure out why this regexp isn't working in my rails method. I've been testing it with the the firefox regular expression tester add on and it works there but not in the rails app. My expression is: /\Q[img['\E/ I'm trying to match

[Rails] Regular expression not working in Rails

2011-02-15 Thread Keith Raymond
I can't figure out why this regexp isn't working in my rails method. I've been testing it with the the firefox regular expression tester add on and it works there but not in the rails app. My expression is: /\Q[img['\E/ I'm trying to match: [img[' I am getting an error saying "Early end to regex

Re: [Rails] Regular Expression

2010-10-16 Thread Colin Law
Having said that the logic should be in the controller I thought I would point out a couple of errors in your code anyway so you may understand more what was happening. On 15 October 2010 20:49, Colin Law wrote: > On 15 October 2010 13:42, PalaniKannan K wrote: >> Dear All, >> >> I need to apply

Re: [Rails] Regular Expression

2010-10-16 Thread PalaniKannan K
Dear Collin, Thank you. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com.

Re: [Rails] Regular Expression

2010-10-15 Thread Colin Law
On 15 October 2010 13:42, PalaniKannan K wrote: > Dear All, > > I need to apply a regular expression in html.erb > > <% taxon_name.strains.each do |strain| %> > <% taxon_name.strain_appendices.each_with_index do |strain_appendice, i| %> > <% if ((strain_appendice.data_source =~ /LPSN/) && (strain.

[Rails] Regular Expression

2010-10-15 Thread PalaniKannan K
Dear All, I need to apply a regular expression in html.erb <% taxon_name.strains.each do |strain| %> <% taxon_name.strain_appendices.each_with_index do |strain_appendice, i| %> *<% if ((strain_appendice.data_source =~ /LPSN/) && (strain.relevance =~ /^ty(.*)ain$/))%>* <% if i == 0 %> <%= strain_a

Re: [Rails] regular expression

2010-06-04 Thread Peter De Berdt
On 04 Jun 2010, at 14:28, Srinivas Golyalla wrote: Can u help me in simple regular expression that will match the string ‘123_456_7890’ but not ‘123_456_789’. The thing you're asking is not very specific, there's a lot to be interpreted, but this might be what you are looking for: \d{3}_\d{

[Rails] regular expression

2010-06-04 Thread Srinivas Golyalla
Can u help me in simple regular expression that will match the string ‘123_456_7890’ but not ‘123_456_789’. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubsc

Re: [Rails] regular expression problem

2010-04-27 Thread Vladimir Rybas
nice one David! On Tue, Apr 27, 2010 at 5:34 PM, David A. Black wrote: > Hi -- > > On Tue, 27 Apr 2010, Vladimir Rybas wrote: > > "Antigua and Barbuda (+1268)".scan(/\d+/).to_s >> => 1268 >> >> "Antigua and Barbuda (+1268)".scan(/\(\+\d+\)/).to_s >> => (+1268) >> > > There's a nice technique fo

Re: [Rails] regular expression problem

2010-04-27 Thread David A. Black
Hi -- On Tue, 27 Apr 2010, Vladimir Rybas wrote: "Antigua and Barbuda (+1268)".scan(/\d+/).to_s => 1268 "Antigua and Barbuda (+1268)".scan(/\(\+\d+\)/).to_s => (+1268) There's a nice technique for quickly getting a substring from a string using a subscript-style notation: "Antigua and Barb

Re: [Rails] regular expression problem

2010-04-27 Thread Vladimir Rybas
"Antigua and Barbuda (+1268)".scan(/\d+/).to_s => 1268 "Antigua and Barbuda (+1268)".scan(/\(\+\d+\)/).to_s => (+1268) On Tue, Apr 27, 2010 at 4:47 PM, HUNT HUNT wrote: > var text="Afganistan (+86)" > var code=text.sub(/\w+/, '') > result: code = (+86) > -- > > va

[Rails] regular expression problem

2010-04-27 Thread HUNT HUNT
var text="Afganistan (+86)" var code=text.sub(/\w+/, '') result: code = (+86) -- var text = "Antigua and Barbuda (+1268)" var code=text.sub(/\w+/, '') result : code = and Barbuda (+1268)" -- what regular expression I can try to get

Re: [Rails] regular expression

2010-03-23 Thread Andy Jeffries
$ irb >> "module$block.item"[/\$(.*?)\./, 1] => "block" Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 23 March 2010 14:03, Marcio Machado wrote: > Hi, > > I´m

[Rails] regular expression

2010-03-23 Thread Marcio Machado
Hi, I´m trying to write a regular expression to get the substring "block" in: "module$block.item" I´ve reached the obvious /\$.*\./ witch returns "$block." substring. How do I get directly the "block" substring? -- Posted via http://www.ruby-forum.com/. -- You received this message because yo

Re: [Rails] Regular expression: How do I allow forward slashes?

2009-12-18 Thread maryam kamali
inotwell cumpiuter &and lunguish engilish thanks On Sat, Dec 19, 2009 at 10:31 AM, AlwaysCharging wrote: > In my app, I allow users to submit urls. They (of course) need the > ability to submit urls with a forward slash, "/", but whats the > regular expression to allow them to do that? > > I cu

[Rails] Regular expression: How do I allow forward slashes?

2009-12-18 Thread AlwaysCharging
In my app, I allow users to submit urls. They (of course) need the ability to submit urls with a forward slash, "/", but whats the regular expression to allow them to do that? I currently use: validates_format_of :url, :with => /^[-\w\_.]+$/i to only allow alphanumerics, dashes, underscores, an

[Rails] regular expression matching date, author and agency in string

2009-09-11 Thread Sandip Ransing
Hello All, I wanted regular expression for the following patterns like Nauzer Bharucha, TNN 10 September 2009, 12:01am IST IANS 3 September 2009, 02:57pm IST regular expression should return *date* in first group *author* in second group and *agency* in third group for below pattern it should

[Rails] regular expression help needed

2009-09-11 Thread Sandip Ransing
Hello I am very week with regular expressions. It may be too easy for someone. I have following regular expression loc_content_re = /(?:([A-Za-z\s:]*?):)?([\s\S]*)/ > content = "HYDERABAD/NEW DELHI: Andhra Pradesh chief minister was " > I wanted to extract "HYDERABAD/NEW DELHI" from above

[Rails] Regular expression

2009-06-19 Thread Newb Newb
hi friends.. in my application i have number of days field. it Should not allow user to input special characters in the field.and it Should not allow blank space in the Number of Days field. what regular expression can i use... Thanks a lot -- Posted via http://www.ruby-forum.com/. --~--~---

[Rails] Regular Expression question

2009-02-27 Thread northband
Hi - I would like to use gsub() to strip decimals with trailing zeros from a string. My string looks like this: -- 19.0 " / 482.600 mm -- I would like to end up with this: -- 19 " / 482.6 mm -- Anyone have a regular expression that can do this? Thanks! --~--~-~--~~~---

[Rails] Regular Expression Grouping

2008-10-19 Thread mars
Hi! I couldn't understand the behavior of this code: match = 'Today is Feb 23rd, 2003'.match(/Feb 23(rd)?/) a = match.to_a puts a.size# 2 puts a.join(",") # Feb 23rd,rd puts a[0] # Feb 23rd puts a[1] # rd In my understanding, /F

[Rails] Regular expression to identity special character

2008-09-27 Thread Abhishek shukla
Hello friends i need a regular expression which will check if the string contain the special character or not? and accordingly it should return true, false value. Thanks abhi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

[Rails] Regular Expression pattern matching question...

2008-09-24 Thread ressister
Hi there, I'm trying to split a string using RegExp to extract a price from it. The price may or may not have a dollar sign in front of it and may or may not contain a decimal value. Below are some string examples of what the regular expression would need to handle to split out the price: Examp