Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Regexp help

by muba (Priest)
on Nov 22, 2012 at 01:23 UTC ( #1005036=note: print w/ replies, xml ) Need Help??


in reply to Regexp help

First of all, what do you mean by null? I will assume you mean undef, but you might as well mean the numerical value 0.

Secondly, one of Perl's slogan's is There Is More Than One Way To Do It, or TIMTOWTDI as we say. This applies here as well. There is no the correct way, there are many.

My next question, thus, is: what have you tried? Why didn't it work? Did you get any error messages and if you did, which? How did your output not meet your expectations?

Lastly, a regular expression in the traditional sense (m//) might not b the most suitable task. What you have is a | delimited string, so most likely you'll want to split on that. Keep in mind that split takes a regular expression as its first argument, and | has a special meaning inside regular expression so you'll have to escape that.

Then you'll want to iterate over the list you get, using something like map for example, or if you're uncomfortable with those merits of functional programming, you could do it with a simple foreach loop over the array.

This should give you the building blocks you're looking for.


Comment on Re: Regexp help
Select or Download Code
Re^2: Regexp help
by hey_frind (Initiate) on Nov 22, 2012 at 18:14 UTC

    Thank you.

    the back ground is I am using regexp in sql (not really perl this time)

    I tried the following:

    REGEXP_SUBSTR({total},'^*', 1, 1) where total is the input string

    I result I am getting is its not recongizing the empty (or null) columns.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005036]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2014-10-22 02:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (112 votes), past polls