• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regualar expressions in Javascript.

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am trying to do a regular expression that just grabs the filename(not the extension of an image file). I have ton's of files and they all are in different folders so it needs to be generic enough so one fits all case.

So far I use a program called Expresso that allows your to write the regular expression and see it filter. Then we your done you can generate C# code for it. It does not support javascript though.

So I got this:

(?imx-sn [a-z]*/(?<character>[a-z]+)\.\bgif\b

(?imx-sn - stuff for ignoring case and lines.

?<character>[a-z]+)- I want to capture this in a name class and call this later.

So I don't really know how to make this into javascript syntax. I am also unsure if this will effect Jquery(or if it need anything special) since this will be embedded in a jquery method(the .each loop)

Sample img links:

<img style="border-width: 0px;" src="Images/Hiragana/a-o/a.gif"/>
<img style="border-width: 0px;" src="Images/Hiragana/Special-Characters/Ten-Ten/ga-go/ga.gif"/>
[ June 14, 2008: Message edited by: Michael Hubele ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Hubele:
(?imx-sn [a-z]*/(?<character>[a-z]+)\.\bgif\b

You'll need to be sure that 'disable smilies' is checked when posting code. That way, you're regular expressions will look less happy.

I am also unsure if this will effect Jquery(or if it need anything special) since this will be embedded in a jquery method(the .each loop)

jQuery is just JavaScript. No effect.
 
Michael Hubele
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya keep forgetting. That should be on by default.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Hubele:
That should be on by default.

Not sure what you mean by "that".
 
Michael Hubele
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
Not sure what you mean by "that".



Sorry. I meant the "Disable smilies in this post" should be on by default.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, yeah I agree. It's disabled by default for some forums, but not this one.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic