Angular NgTagsInputs - RegEx - Allow all values expect Strings - angularjs

I'm using ngTagsInput where I want to allow all tags expect a few strings.
In their documentation it appears I can specify allowed tags through a regex but I can seem to work it out - been trying http://regexr.com/ for last hour with no luck.
So for example the strings I dont want to be accepted are:
story and global.
How do i go about to say everything is allowed expect those 2?
So for example storyBreaking is allowed but story is not.
Thanks.

try something like that:
(?<![\w\d])abc(?![\w\d]) where abc is your string to match!

Related

Can't get Logic App Contains to work with array or comma separated string

I'm trying to look for specific keywords inside of text from a for each loop.
var text = "The lazy fox jumped over the brown dog."
var keywords = "fox,dog,sun";
If true, I want to do something with the text. If false, I want to ignore the text.
Does anyone know how to use an Array filter, Function, Select, Condition or inline code to check for this? If so, specific examples would be great.
By the way, I have a C# function that handles this extremely well in an ASP.net Core app.
UPDATE 1:
This doesn't work.
UPDATE 2:
The Condition is always false after the for each loop even after changing the settings and parallelism to 1.
Azure Logic App Condition does not work in loop if based on changing values
Thanks in advance!
There are so many ways to achieve what you need. Here are the 3 options that came to my mind within a minute.
The first one does use a For each loop, but I wouldn't recommend using it as it's not very efficient.
The For each parameter looks like this:
The Condition parameter looks like this:
The second option is much easier - no need for a loop, just filter the array straight away, then you can check whether it's empty or it has some items:
The Filter array parameters look as follows.
The split function is identical to the one used in option 1.
If you know JavaScript, you might decide to use regular expressions in inline code instead, e.g.:
Then you'd just need to check the output of the inline code. JavaScript code used in the example above:
var text = workflowContext.actions.Compose_text.outputs;
var keywords = workflowContext.actions.Compose_keywords.outputs;
return text.match(new RegExp("(" + keywords.split(",").join("|") + ")", "gi"));
My personal preference is option 2. However, please note that all 3 options above would find "sun" in text "The weather was sunny" even though there's no word "sun" in the text. If you do need "sun" to match only word "sun" - not "sunny", "asunder" or "unsung" - then go for option 3, just use a different, more complex regular expression.
One of the workaround would be use of Condition Connector. I have initialized the sentence in a string and then used Condition Connector which will be checking the conditions.
Finally, In the true section you can add the connectors accordingly.
Placing a Compose behind the for each loop and referencing the Output in the Condition is what finally worked for me. I used the toLower() function in my Compose. The Compose looks like this.
toLower(items('For_each_2')?['day']?['longPhrase'])

regex with OR condition not working in angularjs [duplicate]

I'm creating a javascript regex to match queries in a search engine string. I am having a problem with alternation. I have the following regex:
.*baidu.com.*[/?].*wd{1}=
I want to be able to match strings that have the string 'word' or 'qw' in addition to 'wd', but everything I try is unsuccessful. I thought I would be able to do something like the following:
.*baidu.com.*[/?].*[wd|word|qw]{1}=
but it does not seem to work.
replace [wd|word|qw] with (wd|word|qw) or (?:wd|word|qw).
[] denotes character sets, () denotes logical groupings.
Your expression:
.*baidu.com.*[/?].*[wd|word|qw]{1}=
does need a few changes, including [wd|word|qw] to (wd|word|qw) and getting rid of the redundant {1}, like so:
.*baidu.com.*[/?].*(wd|word|qw)=
But you also need to understand that the first part of your expression (.*baidu.com.*[/?].*) will match baidu.com hello what spelling/handle????????? or hbaidu-com/ or even something like lkas----jhdf lkja$##!3hdsfbaidugcomlaksjhdf.[($?lakshf, because the dot (.) matches any character except newlines... to match a literal dot, you have to escape it with a backslash (like \.)
There are several approaches you could take to match things in a URL, but we could help you more if you tell us what you are trying to do or accomplish - perhaps regex is not the best solution or (EDIT) only part of the best solution?

angular ui.mask for variable length format

i am trying to use angular ui.mask module to display a full length url based on user entering a section name(suffix)
http://www.example.com/XYZ where 'XYZ' is the user input.
While a mask 'http://www.example.com/AAA' works fine, it does limit the user to entering only 3 character.
Any quick ways to extend the length accepted?
I tried altering the regex to accept variable length, but haven't got this working.
Any help would be appreciated.
Thanks.
This can be accomplished by using a question mark before any character in the mask that would be optional.
In your case, it would look like:
ui-mask='http://www.example.com/?A?A?A?A?A?A?A?A?A?A?A?A?A?A?A?A'
Better late than never...

Angular strict spell search

How can I search names starting from first letter that user types, I want to know if user types B then names starting from B must be displayed rather than "SBI" word where B comes in second position. I want to search specific words which has first word match.
for example: if
list ={SBI,
BSI,
isb,
bsisib,
be happy,
dont worry,
hello}
Then If i type h character then I want all the words starting from 'h'. but when i tried it shows 'be happy' 'hello' result for h. I want hello only. Thank you
If you're list isn't extremely long try applying a regular expression on each item in ng-repeat filter.
Not sure if you want first word or first character in each word.
Try the following plunker.
If you are using this on input field, then
I suggest you to use an existing autocomplete solution for angularjs. There are many of them out there and are quite easy to use.
http://ngmodules.org/modules/ngAutocomplete
Plunkr:http://plnkr.co/edit/il2J8qOI2Dr7Ik1KHRm8?p=preview
http://angular-ui.github.io/bootstrap/
Check the typeahead from angular ui bootstrap.
Or just google angularjs autocomplete, you will find tons of results.

Eclipse - How do I view java arrays / collections better in debugger

Viewing/Searching java arrays and collections in the Eclipse Java debugger is tedious and time-consuming.
I tried this promising plugin (in alpha as of Aug 2012)
http://www.cvast.tuwien.ac.at/projects/visualdebugging/ArrayExplorer
But it freezes Eclipse for simple arrays beyond a few hundred elements.
I do use Detail formatters, but that still needs clicking on each element to see the values.
Are there any better ways to view this array/collection data?
Use the 'Expressions' tab.
There you can type in any number of expressions and have them evaluated in the current scope.
ie: collection.size(), collection.getValueAt(i), ect...
Eclipse > Preferences > Java > Debug >Detail Formatter
This may be close to what you are looking for. It is another tedious work to setup but once done you can see the value of objects in Expressions window.
Here is link to start
override toString method of your class and you will be able to see what you want to see. i'm attaching example to show you exactly that.
Even though i could not find a way to see them in nice table/array, i found a halfway workaround.
The solution is to define a static method in a throwaway class that takes the array as input and returns a string of concatenated values that one wants to quickly glance at. it could include the array index and newlines to view results formatted nicely. It can be fine tuned to print out only certain array indices to reduce clutter.
This static method can then be used in the watch area.

Resources