How ton implement a not regexp_like() in datastage - datastage

I working on migration and I would like to implement this expression on datastage (transformer) :
not regexp_like(column,'^[[:digit]]+$')
thank you

There is no support for REGEX in the Transformer stage. One solution would be to use the Data Rules stage (if you have it), which does have a MATCHES_REGEX operator.
Another solution would be to use a BASIC Transformer stage, which has a Matches operator (though it uses a syntax other than regex; you'd need something like column Matches "0N'+')

Related

Reading CSV file with Spring batch and map to Domain objects based on the the first field and then insert them in DB accordingly [duplicate]

How can we implement pattern matching in Spring Batch, I am using org.springframework.batch.item.file.mapping.PatternMatchingCompositeLineMapper
I got to know that I can only use ? or * here to create my pattern.
My requirement is like below:
I have a fixed length record file and in each record I have two fields at 35th and 36th position which gives record type
for example below "05" is record type which is at 35th and 36th position and total length of record is 400.
0000001131444444444444445589868444050MarketsABNAKKAAAAKKKA05568551456...........
I tried to write regular expression but it does not work, i got to know only two special character can be used which are * and ? .
In that case I can only write like this
??????????????????????????????????05?????????????..................
but it does not seem to be good solution.
Please suggest how can I write this solution, Thanks a lot for help in advance
The PatternMatchingCompositeLineMapper uses an instance of org.springframework.batch.support.PatternMatcher to do the matching. It's important to note that PatternMatcher does not use true regular expressions. It uses something closer to ant patterns (the code is actually lifted from AntPathMatcher in Spring Core).
That being said, you have three options:
Use a pattern like you are referring to (since there is no short hand way to specify the number of ? that should be checked like there is in regular expressions).
Create your own composite LineMapper implementation that uses regular expressions to do the mapping.
For the record, if you choose option 2, contributing it back would be appreciated!

How To Form Complex Where Filters In Loopback Using REST Style Syntax

For consistency we need to use the REST URL style syntax (rather than JSON style syntax) when calling our Loopback apis. However, we are having difficulty structuring complex 'where' filters that include both 'and' and 'or' operators. There does not appear to be a way to group mixed conditional logic. For example, how would we create the equivalent of this SQL statement using REST syntax:
SELECT * FROM Customer WHERE (type='retail' OR type='nonprofit') AND terms='monthly'
For example, this does not work:
/api/customer?filter[where][or][0][type]=retail&filter[where][or][1][type]=nonprofit&filter[where][and][2][terms]=monthly
Try with something like this:
/api/customer?filter={
"where": {
"or": [
{"type":"retail"},
{"type":"nonprofit"},
"and": [{"terms":"monthly}]
]
}
}
Take a look to Where filter in "More complex example"
I am trying to work out a similar issue. Looks like you are pretty close, but I believe and is actually the top level comparison, and you are writing your query as if or is. So maybe..
/api/customer?filter[where][and][0][or][0][type]=retail&filter[where][and][0][or][1][type]=nonprofit&filter[where][and][1][terms]=monthly
I have no way to confirm this though as I do not have a functioning local environment with which to test it. Let us know if it works out. Thanks!
Update: Looks like this question has already been answered. https://github.com/strongloop/loopback/issues/3017 BLUF, it isn't possible in Loopback. Use the stringified JSON option.

UIMA Ruta negating conditions

This might be a trivial question, but I'm new to Ruta so bear with me please.
My testdata consists of numbers in the following format:
0.1mm 0,11mm 1.1mm 1,1mm 1mm
I use the following rule to annotate the first four examples:
((NUM(COMMA|PERIOD)NUM) W{REGEXP("mm")}) {-> nummm};
Document{->MARK(nummm)};
Now I want to annotate "1mm", for example, too, but I'm kind of stuck right now, because I have no idea how to do this. I tried negating Conditions, like AFTER (as in "if NUM mm not after comma or period"), but it either didn't work or the syntax was wrong. Any help would be appreciated!
EDIT: I should add that I want to annotate "1mm", but not the 1mm part after a comma or period, as of right now i basically annotate everything twice.
There are really a lot of ways to specify this in UIMA Ruta.
Here's the first thing that came to my mind:
(NUM{-PARTOF(nummm)} (PM{PARTOF({COMMA,PERIOD})} NUM)? W{REGEXP("mm")}){-> nummm};
This is probably not the "best" rule but should do what you want. There are three main changes:
I made the middle part of the rule optional so that it also matches on a single NUM.
I added the negated PARTOF of at the first rule element thus the matching will fail if the starting point is already covered by a nummm annotation. The - is a shortcut for the NOT condition.
I replaced the expensive disjunctive composed rule element with a simple one just because it is not really necessary here.
This rule works because the actions of a rule match are already executed before the next rule match is considered.
DISCLAIMER: I am a developer of UIMA Ruta.

Special character indexing

i am creating a Lucene 3.0.3 index using StandardAnalyzer.
when searching is made on index using query like C, C# or C++ it gives same result for all these three term. As, i know while creating index analyzer ignore special character and do not create index for same.
Need to be able to differentiate between "C", "C#" and "C++"
please suggest me that, Is any existing analyzer will resolve this issue?
Any suggestion will be appreciated!!!
I guess that happens because of the fact that StandardAnalyzer uses StandardFilter, which uses StandardTokenizer, which removes special characters.
You could create your own Analyzer implementation.
See http://www.gossamer-threads.com/lists/lucene/java-user/91747?do=post_view_threaded#91747

Regular Expressions (HTML parsing on iPhone)

I am trying to pull data from a website using objective-c. This is all very new to me, so I've done some research. What I know now is that I need to use xpath, and I have another wrapper for that called hpple for the iPhone. I've got it up and running in my project.
I am confused about the way I retrieve information from the site. Apparently I am to use regular expressions in this line of code:
NSArray * a = [doc search:#"//a[#class='sponsor']"];
This is just an example. Is that stuff in the search:#"...." the regular expression? If so, I guess I can develop the hundreds of patterns that I will need for my program to parse the site (I need a lot of data), but is there a better way? I'm very lost in this. Any help is appreciated.
The parameter is an XPath, not a regular expression. Here's a breakdown:
All xpaths are interpreted relative to a context node. In this case, it's the root node.
// is an abbreviation meaning "all descendents"
a means "all child nodes with a node type of 'a'" (in HTML, that's anchors)
[...] contains a predicate, refining just which a to match
# is an abbreviation for attribute nodes
#class means an attribute named "class"
#class='sponsor' means a class attribute equal to "sponsor". Note this will not match nodes with a class containing "sponsor", such as <a class="big sponsor" ...>; the class must be equal.
All together, we have "'a' nodes descending from the root that have class equal to 'sponsor'".
That is an XPath expression, not a regular expression. The W3C has an XPath reference here: http://www.w3.org/TR/xpath/. Basically you are searching for <a> elements with the class "sponsor".
Note that this is a good thing! Regular expressions are bad for parsing HTML.