In the example below, is there any way to place a string like ("1one1") before {",} at the end of all lines which contain {ī}?
īn:"ZZin",
ín:"FFin",
ǐn:"QQin",
ìn:"TTin",
ie:"XXie",
iē:"TTie",
ié:"GGie",
Thanks
Using Notepad++ regex search for ^(.*ī.*)(",)$ and replace with \11one1\2.
You will need to use regex regex for notepad++.
so, mark "Regular Expression" in the final of Replace box.
in your fields to search:
find what: ī.[^"]"([A-Za-z0-9]*)
replace with: īn:"\11one1
i think it will do what you want. Let me know if it doesn't to edit the regex.
I have a txt files with some lines containing GPS data, which I need to shorten.
So I have
5|{"mResults":0.0|0.0|"mProvider":"fused"|"mDistance":0.0|"mTime":1395061255413|"mAltitude":161.0|"mLongitude":29.0459152|"mLon2":0.0|"mLon1":0.0|"mLatitude":41.0854122|"mLat1":0.0|"mLat2":0.0|"mInitialBearing":0.0|"mHasSpeed":true|"mHasBearing":false|"mHasAltitude":true|"mHasAccuracy":true|"mAccuracy":15.0|"mSpeed":0.425211|"mBearing":0.0}|1395061255413
and I need to extract only the coordinates,
so convert it into this :
29.0459152|41.0854122
Edit:
Turns out I need this:
GPS|29.0459152|41.0854122|0|1395061255413
Please note that I need to :
add GPS| in front, and |0 at the end.
and also I need to append the timestamp value (the last value in the original one) |1395061255413
How can I do this with Notepad++?
Thanks for any help !
Here is how you could do that in Notepad++:
use Ctrl+H to open the Replace pop-up
tick Regular expression in the Search mode section
search for this pattern: .*?"mLongitude":(\d+(?:\.\d+)?).*?"mLatitude":(\d+(?:\.\d+)).*
replace the matched string by \1|\2
click on Replace all ;)
How it works:
The regex pattern featured in my answer extracts the values for the longitude and latitude from each line and replaces the whole line by:
the mLongitude value,
a literal "|" and
the mLatitude value.
Would you like to have this pattern explained in more details, please check out this permalink on regex101.
EDIT:
To include the timestamp you're referring to, you need to use this regex:
.*?"mLongitude":(\d+(?:\.\d+)?).*?"mLatitude":(\d+(?:\.\d+)).*\|(\d+)
Then, you just have to change the formatting of your replacement string to this:
GPS|\1|\2|0|\3
You probably got that already but let's still write down the complete usable solution ;)
I hope this helps!
I solved my problem by this :
search:
.*?"mTime":(\d+(?:\.\d+)?).*?"mLongitude":(\d+(?:\.\d+)).*?"mLatitude":(\d+(?:\.\d+)).*
replace :
GPS|\2|\3|0|\1
But this is because the same data (timestamp) was also inside the string. So this does not extract the timestamp from the end, but from the middle of the string.
So if #ccjmne edits the answer that extracts it from the end, I will accept that answer.
Before somebody points me to that question, I know that one can't parse html with regex :) And this is not what I am trying to do.
What I need is:
Input: a string containing html.
Output: replace all opening tags
***<tag>
So if I get
<a><b><c></a></b></c>, I want
***<a>***<b>***<c></a></b></c>
as output.
I've tried something like:
(<[~/].+>)
and replace it with
***$1
But doesn't really seem to work the way I want it to. Any pointers?
Clarification: it's guaranteed that there are no self closing tags nor comments in the input.
You just have two problems: ^ is the character to exclude items from a character class, not ~; and the .+ is greedy, so will match as many characters as possible before the final >. Change it to:
(<[^/].+?>)
You can also probably drop the parentheses and replace with $0 or $&, depending on the language.
Try using: (<[^/].*?>) and replace it with ***$1
I have some CSV data like this:
1325318514,197.1,184.9,172.4,146.0,147.3,131.1,280.9,182.7,12.6,5.0,0.0,73001,65848,0
1325318536,196.2,184.2,172.1,146.3,147.1,131.1,264.9,175.6,12.6,5.0,0.0,71590,64616,0
1325318557,196.6,184.9,172.1,147.6,146.8,130.9,264.9,178.4,12.6,5.0,0.0,69607,61274,0
1325318578,196.7,184.2,172.1,148.4,146.8,130.6,255.9,174.0,12.5,5.0,0.0,74127,59221,0
....
i want to replace the first , with a space on each string but not the rest of the ,s
Any ideas on the regexp for that? Tried a few different things and just cant seem to get it to work...
your question is not very clear, I just give an example, hope it is helpful for you:
sed 's/,/ /1' <<<"1325318514,197.1,184.9,172.4,146.0,147.3,131.1,280.9,182.7,12.6,5.0,0.0,73001,65848,0
1325318536,196.2,184.2,172.1,146.3,147.1,131.1,264.9,175.6,12.6,5.0,0.0,71590,64616,0
1325318557,196.6,184.9,172.1,147.6,146.8,130.9,264.9,178.4,12.6,5.0,0.0,69607,61274,0
1325318578,196.7,184.2,172.1,148.4,146.8,130.6,255.9,174.0,12.5,5.0,0.0,74127,59221,0"
output:
1325318514 197.1,184.9,172.4,146.0,147.3,131.1,280.9,182.7,12.6,5.0,0.0,73001,65848,0
1325318536 196.2,184.2,172.1,146.3,147.1,131.1,264.9,175.6,12.6,5.0,0.0,71590,64616,0
1325318557 196.6,184.9,172.1,147.6,146.8,130.9,264.9,178.4,12.6,5.0,0.0,69607,61274,0
1325318578 196.7,184.2,172.1,148.4,146.8,130.6,255.9,174.0,12.5,5.0,0.0,74127,59221,0
In most regex implementations, use the pattern
/([^,]*),(.*)/gm
And replacement text
$1 $2
See it online at http://refiddle.com/1ot