Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
So I have a query I have written for my pbx to get data out, the script here works perfectly
Code:
select caller_id_number,caller_destination,destination_number,start_stamp from today_call_records WHERE start_stamp > now() - interval 5 minute AND direction = 'inbound' AND domain_name = 'pbx.mydomain.co.uk' AND destination_number NOT regexp '^([1000-1999])' AND destination_number NOT regexp '^([*90])' AND destination_number NOT regexp '^([*89])' AND destination_number NOT regexp '^([*88])' AND destination_number NOT regexp '^([*87])' AND destination_number NOT regexp '^([*86])' AND destination_number NOT regexp '^([*85])' AND destination_number NOT regexp '^([*84])' AND destination_number NOT regexp '^([*83])' AND hangup_cause NOT like 'USER_BUSY' ORDER BY start_stamp
Now I also need to exclude from the sql query *82 *81 & *80 but if I add any more eg another
Code:
AND destination_number NOT regexp '^([*82])'
Then I don't get any errors but also don't get any data. As soon as I remove the extra bit of query it works fine.
Is there some sort of limitation in the queries or is there anything I can do to resolve the issue
I suspect the solution can be one or two simple regexes, but I'm making no attempt to read that query until you format it and use "[code]..[/code]" tags to preserve the formatting.
From the above yes I forgot the extra single quote but that's not missing when I add further examples. My issue is if I add anymore to the original query IE and extras
Code:
AND destination_number NOT regexp '^([*82])'
I fail to get anything from the database and no errors.
what you posted is still not enough to diagnose. I can only guess: somehow/somewhere there was a line length limit set.
posting parts of a line without knowing anything about the context/environment is simply useless. http://www.catb.org/~esr/faqs/smart-...html#beprecise
Regular expression ^([*82]) means 'all lines starting with *, 8 or 2 - is this what you really want? It's also a good idea to mention what kind of SQL you use and what flavour of regular expression in supports.
@pan64 the whole sql query is at the root of the question, nothing is missing from the query and it's not just part of a query
@lvm We are trying to track missed calls as the system does not do it correctly. From the report we need to exclude all the instances of eg *81 *82 *83 etc as these are features codes we have built in and are not missed calls as the customer has chosen them.
You didn't make it much clearer, but if by this you mean CDRs starting with '*81', '*82' and so on then your regexp should be '^\*8[1-3]', not what you typed. Wikipedia has a nice article about regular expressions, read it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.