Quantcast
Channel: Symantec Connect - Téléchargements
Viewing all articles
Browse latest Browse all 322

Using Code Script Component with regex pattern (Workflow)

$
0
0

I had the challenge to group mobile devices into mobile phone or tablets. For example, for Apple devices this was quite easy because the model either contains iPhone or iPad. However, looking at the model of Samsung devices this looks different. Here some examples:  

samsung GT-P5210

samsung SM-G25F

samsung SM-G920F

samsung SM-G900F

samsung GT-I9506

I directly thought I can use Regex pattern to tackle the grouping however, I did not find a way to have the possibility of having a dynamic list of patterns in case new models are released and I do not want to open the workflow and republish it every time when an update comes out.

So I thought I might be able to use a list outside of workflow which I can go in and edit and this list I read within the workflow.

To read the list is one thing the other thing is to build the pattern from that list. Again this seems not something I could do with the built in “pattern” components. That is why I choose the Code Script component. The code script component now reads the list builds the pattern and does the matching.

Here the Workflow:

regex_1.png

Here the Script (Code) Component:

regex_2.png

Here the code:

regex_3.png

Here the input list:

regex_4.png

And here the result:

regex_5.png

And if I update the list:

regex_6.png

The result be like this:

regex_7.png

Find the demo attached.


Viewing all articles
Browse latest Browse all 322

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>