I need help with two instances where I need to utilize Reguar Expressions.
In this example A18040500198 ARM88 I need to extract ARM88 and using the same example I need to extract A18040500198
Would anybody be able to help me with this. Thank you very much in advance.
"(A[0-9]*)|(ARM88))" would return both strings, but many others too.
If you need to only return exactly those two strings, use "(A18040500198)|(ARM88)"
More information on what you specifically want the RegEx to do would be useful.
Related
I have around 300k unstructured data as below screen.I'm trying to use Google refine or OpenRefine to make this correct. However, I'm unable to find a proper way to do this. I'm new to this tool. Anyone's help would be greatly appreciated.Also, this tool is quite slow to process 300k records. If I am trying out something its taking lots of time to process and give an output.
OR Please suggest any other opensource tools and techniques do this?
As Owen said in comments, your question is probably too broad and cannot receive acceptable answer. We can just provide you with a general procedure to follow.
In Open Refine, you'll need to create a column based on the messy column and apply transformations to delete unwanted characters. You'll have to use regular expressions. But for that, it's necessary to be able to identify patterns. It's not clear to me why the "ST" of "Nat.secu ST." is important, but not the "US" in "Massy Intertech US". Not even the "36" in "Plowk 36" (Google doesn't know this word, so I'm not sure is an organisation name).
On the basis of your fifteen lines, however, we seem to distinguish some clear patterns. For example, it looks like you'll have to remove the tokens (character suites without spaces) at the end of the string that contain a #. For that, the GREL formula in Open Refine could look like this:
value.trim().replace(/\b\w+#\w+\b$/,'')
Here is a screencast if it's not clear to you.
But sometimes a company name may contain a #, in which case you will need to create more complex rules. For example, remove the token only if the string contains more than two words.
if(value.split(' ').length() > 2, value.replace(/\b\w+#\w+\b$/, ''), value)
And so on for the other patterns that you'll find (for example, any number sequence at the end that contains more than 4 numbers and one - between them)
Feel free to check out the Open Refine documentation in case of doubt.
So I am going to find the occurrence of s in d. s = "infinite" and d = "ininfinintefinfinite " using finite automaton. The first step I need is to construct a state diagram of s. But I think I have problems on identifying the occurrence of the string patterns. I am so confused about this. If someone could explain a little bit on this topic to me, it'll be really helpful.
You should be able to use regular expressions to accomplish your goal. Every programming language I've seen has support for regular expressions and should make your task much easier. You can test your regexs here: https://regexr.com/ and find a reference sheet for different things. For your example, the regex /(infinite)/ should do the trick.
I have a list of Exchanges (extract shown below) and I want to give a user WRITE permissions to all but those containing Invoice in the name. Here an extract of the list of Exchanges as an example:
E.BankAccount.Commands
E.BankAccount.Commands.Confirmations
E.BankAccount.Commands.Errors
E.BankAccount.Events
E.Customer.Commands
E.Customer.Commands.Confirmations
E.Customer.Commands.Errors
E.Customer.Events
E.Invoice.Commands
E.Invoice.Commands.Confirmations
E.Invoice.Commands.Errors
E.Payment.Commands
E.Payment.Commands.Confirmations
E.Payment.Commands.Errors
E.Payment.EventsEvents.test
So I can write a regex like this:
E\.(BankAccount|Customer|Payment)\.[a-zA-Z.]+
This works but since I have more than 100 different types it is a lot to type and almost impossible to maintain. Better would be to have a regex which excludes invoice. I tried a couple of things but without any look, e.g.
E\.([a-zA-Z.]+|?!Invoice)\.[a-zA-Z.]+ or
E\.([a-zA-Z.]+|?!(Invoice))\.[a-zA-Z.]+
But that is all syntactically wrong. Another strategy could be to reverse the result of the expression e.g. use
E\.(Invoice)\.[a-zA-Z.]+
and then somehow reverse the entire result but I could not figure out how!
I am not using regex very often so I can't find any better solution then the first one which is impracticable in my production environment.
Does anybody have more experience and a solution to that problem?? Any help would be greatly appreciated!
I have a field in SSRS that i need to filter on.
For 3 table I can use a IN filter.
But I am in need to use a NOT IN operator. The field contains numeric values.
I need to be able to say not in (30,31,32,33,34,35,36,37,38,39)
I cant do it within the dataset either, needs to be a filter.
How should I achieve it ?
You can use an expression to determine which values are going to be filtered.
Go to Tablix properties/ Filters
In expression use:
=IIF(Array.IndexOf(split("30,31,32,33,34,35,36,37,38,39",","),
CStr(Fields!YourField.Value))>-1,"Exclude","Include")
For Operator use:
=
For Value use:
="Include"
Let me know if this can help you
For a variation of the selected answer that I find easier to use, please see below. This is in a Visibility expression, but should be easily ported to a Filter expression by setting Expression type to Boolean and comparing if Expression = True:
=IIf(InStr("unwanted values here", Fields!fieldToCheck.Value), True, False)
Firstly I would like to say that, to my knowledge, NOT IN is not available in list of operators for filters.
To Achieve the same thing in other way, please refer the following link..it might help you...
http://blog.datainspirations.com/2011/01/20/working-with-reporting-services-filters-part-4-creating-a-not-in-filter/
Anyone know what group I need to belong to show up in the sp_help_operator list?
Judging from the docs for sp_help_operator, it looks like you need to explicitly add/remove operators using sp_add_operator and sp_delete_operator.
http://msdn.microsoft.com/en-us/library/aa238703(SQL.80).aspx