Pentaho data integration - Replace in String (deleting everthing after a simbol) - replace

I´m new on Pentaho and in one of my fields, I have to delete everything after the first " simbol, just like the example:
CTe35210915180327000160570050000752951251590035" versao="3.00"
I´m trying to use the replace in string using RegEx, but I´m not sure how... anyone can help me?
Best regards,
Ana

You can use step "Modified JavaScript value" and using one simple line [Yourstring.match(/[^"]*/i)[0]] you can do this.
You can look this Transformation.

Related

How would I duplicate a line and change a piece of text inside of the duplicate line?

I have recently ran into a problem that I am searching automation for using RegEx using Notepad++. I have some very limited experience with RegEx in N++, however I cannot figure out how to do the following:
I have the following line:
["Cost"] = 100,
And I want to achieve the following:
["Cost"] = 0,
["CostNew"] = 100,
Since I have many lines of "Cost" as portrayed above with varying values (I'm just using 100 as an example) I would need an automation for this process.
I am aware that you can create a new line by using "\n", but that is as far as my knowledge extends.
Is there a way of doing this with a RegEx expression? Or is it perhaps done better through multiple RegEx expressions?
Thank you in advance for reading my question!
Try this with unticked Match-Case
Find what: (\["cos)([^,])
Replace with: $1t"] = 0,\n$1$2new

Extracting part of a string in Google Sheets

I'm trying to extract the classname from a list of UE4 blueprint paths that look like this:
"Blueprint'/Game/Aberration/CoreBlueprints/Weapons/PrimalItemAmmo_Zipline.PrimalItemAmmo_Zipline'"
The end result needs to be something like this:
PrimalItemAmmo_Zipline_C
I guess the easiest way would be to extract everything between the "." and the apostrophe at the end, before appending the _C. I've tried a few different solutions I've found online, mostly modified from formulas for getting filenames from filepaths, but I can't get any of them to work properly.
What would be the best way to do this?
Assuming the string in A1, try
=substitute(regexextract(A1, "[^.]*$"), char(39)&char(34), "_C")
and see if that works?
try:
=REGEXEXTRACT(A1, "\.(.*)'")&"_C"
for array do:
=ARRAYFORMULA(IFNA(REGEXEXTRACT(A1:A, "\.(.*)'")&"_C"))

How to remove query string ? from image url vb.net

Whats the best way to remove a query string (the question mark variables) from a image url.
Say I got a good image such as
http://i.ebayimg.com/00/s/MTYwMFgxNjAw/z/zoMAAOSwMpZUniWv/$_12.JPG?set_id=880000500F
But I can't really save it properly without adding a bunch of useless checking code because of the query string crap after it.
I just need
http://i.ebayimg.com/00/s/MTYwMFgxNjAw/z/zoMAAOSwMpZUniWv/$_12.JPG
Looking for the proper regular expression that handles this so I could replace it with blank.
It might be simple enough not to worry about regex.
This would work:
Dim cleaned = url.Substring(0, url.IndexOf("?"c))

Grails Filter regexs

I am new to grails and so far i have only been able to use simple filters. I want to use filter in an efficient manner.
(I am using grails 2.4.3, with jdk_1.6)
I want to create a filter to allow accessing AppName/ and AppName/user/login and i could not get it right! I wanted to use regex but i am not getting it right!
i tried this
loggedInOnly(uri:'/**',uriExclude :"*.css|*.js|*image*|/|/user/login"){
before = {
println "### ###### #### #"
}
}
and i also tried to revers the regex parameter, but i am getting no luck! I searched all of google but i could not find a single thread to tell me how filter regex work!
i know i could create xxxx(controller:'*', action:'*') filter then use the controllerName and actionName parameters to check! But there gotta be a better way!
My question in a nutshell: How does regex work in filters?
First, take a closer look at the documentation. Notice that uri and uriExclude are ant paths and not regular expressions. Keeping that in mind if you look how ant paths function you will see they aren't capable of logical ors.
So, with all of that in mind it's back to using enabling regex and using the find attribute instead.
loggedInOnly(regex: true, find: '(.​*.css|.*.js|.*image.*|\\/|\\/user\\/login)​', invert: true){
before = {
...
}
}
Notice I hae used invert to have this filter apply to anything that doesn't match any of the patterns inside the find. Also, I wrote this off the top of my head so you may have to spot check the regular expression in your application (I did check it using groovy web console to make sure I didn't really mess up the syntax).
Hope this helps.

Regular Expression to allow an empty string or a string with specific length

Hi I am having trouble trying to create a regex that will allow me to have the field empty or a string with length 9 if populated.
The current regex im using is: ^[0-9]{9}
Which works if the field is mandatory, however we have a new requirement that this can also be empty. I've tried ^[0-9]{0|9} but obviously that doesnt work.
Thanks in advance
^(|[0-9]{9})$
Should do the trick.
Edit: But seriously; do what #Felix Kling suggests in a comment: test the string via a .length property, .equals("") or the like.