Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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.

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2019-02-16 11:01 GMT
Find Nodes?
    Voting Booth?
    I use postfix dereferencing ...

    Results (95 votes). Check out past polls.