Jump to content

applying Regular Expressions to a query


Recommended Posts

Can I apply regular expressions to a query before passing it on?

 

For example, instead of "tel:{query}"

 

I want to do something more like "tel:{query} s/\(([0-9]{3})\) ([0-9]{3})-([0-9]{4})/\1\2\3"

 

which would effectively strip the telephone number of its parenthesis and dash.

 

Thanks!

 

(P.S., if not possible directly in URI/URL scheme, how to do it with Applescript or Javascript or Ruby or some language?)

(P.P.S. in Alfred it says "URL scheme" but elsewhere I see "URI scheme" online)

Link to comment

Can I apply regular expressions to a query before passing it on?

 

For example, instead of "tel:{query}"

 

I want to do something more like "tel:{query} s/\(([0-9]{3})\) ([0-9]{3})-([0-9]{4})/\1\2\3"

 

which would effectively strip the telephone number of its parenthesis and dash.

 

Thanks!

 

(P.S., if not possible directly in URI/URL scheme, how to do it with Applescript or Javascript or Ruby or some language?)

(P.P.S. in Alfred it says "URL scheme" but elsewhere I see "URI scheme" online)

 

Anything you can do in terminal, or via script can be done in Alfred, so yes. You may have to pass it through a script first, but most of it is usually possible one way or another

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...