I'm trying to merge multiple JSON data sets into one large data set, due to a max limit of 100 on the server I'm pulling them from.
The easiest way to do this would be to eliminate the end of one set and the beginning of the next and replace it with "," so that there would be only one open and close to the entire large set. This is what appears between the last entry of one set and the first entry of the next currently:
],"version":"1.0"}{"error":"OK","limit":100,"offset":100,"number_of_page_results":100,
"number_of_total_results":20235,"status_code":1,"results":[
Again, I need that entire string replaced with just a comma, but the problem I'm encountering is that I had to change the offset between each data set to grab the next 100 entries, so the "offset":100, is different in each string ("offset":200, "offset":300, etc.). I can't seem to get wildcards to cooperate. I suspect it has something to do with all the brackets that are already in the string.
Any help would be appreciated. Thank you.
A regular expression that matches the whole input you provided (provided there's no new line characters) is:
\],"version":"1\.0"\}\{"error":"OK","limit":[0-9]+,"offset":[0-9]+,"number_of_page_results":[0-9]+,"number_of_total_results":[0-9]+,"status_code":[0-9]+,"results":\[
It will get any digits in place off all the numbers in your sample (except version).
Related
I have a column in my access database table, I ran a query to make it proper case by using StrConv([MyColumn],3) but last two letters are state names and this query makes SOmeThing, soMethINg, NY to Something, Something, Ny,
I want the result as Something, Something, NY
Is there a another query I can run after to capitalize last letter?
You can use:
UcaseLast: Left([YourColumn], Len([YourColumn]) - 1) & UCase(Right([YourColumn], 1))
Well, most people would tell you to store your 'address', 'city', and 'state' as separate fields. Then you Proper Case each separately and concatenate them together. If you can do that... that is your best approach.
If this is a database or file that's been tossed at you and you can't make the field/table changes... it's still possible to get your desired results. However, you better make sure all strings end with your state code. Also make sure you don't have foreign addresses since Canadian (and other countries) use more that two letters for the province code at the end.
But if you are sure all records contain two letter state abbreviations, you can continue with the following:
MyColumnAdj: StrConv(Mid([MyColumn],1,len([MyColumn])-2),3) + StrConv(right([MyColumn],2),1)
This takes the midstring of your [MyColumn] from position 1 to the length of your [MyColumn] minus 2 (leaving off the state code) and it Proper Case's it all.
It then concatenates (using the plus sign) to a rightstring of [MyColumn] for a length of 2 and Upper Case's it.
Once again, this is dangerous if the field doesn't have the State Code consistently at the end of the string.
Best of luck. Hope this helps. :)
Using Microsoft Access 2010
I have a field for [box_no]. I need to run a query to get a list of all box numbers within a range. Here is my issue....several box numbers have a letter in front of them (typically the letter "T"), several do not. If I use *Like* '*'+[Search Box Number]+'*' in the query I have no problem searching for a box with or without a letter. I can use *Between [beginning box number] And [ending box number]* in the query to retrieve a range of box numbers, as long as I include the corresponding letter(s). Is there a string or something I can write to get the result I want?
EXAMPLE: I want to retrieve a report for box numbers 732913000 to 732914000. 732913000 through 73213055 do not have a letter in the beginning. 73213056 has the letter T in the beginning (T73213056). I need to make sure all box numbers appear in the report, regardless of the beginning character.
I hope this makes sense! :-)
You can set up a function in VBA to strip out the leading character if its not numeric and then use that function in your query.
The function would be;
Function StripChar(BoxNumber As String) As String
If IsNumeric(Left(BoxNumber, 1)) Then
StripChar = BoxNumber
Else
StripChar = Right(BoxNumber, Len(BoxNumber) - 1)
End If
End Function
You can then use the function in your query;
SELECT BoxNumber, StripChar([BoxNumber]) AS Stripped
FROM <YourTable> WHERE (StripChar([BoxNumber]) Between 100 And 200));
You could probably put the whole thing together using SQL but it's probably easier to work with this because you can easily amend the VBA function to do the adaptation.
I have a large data set, roughly 7000 lines. this has been generated with a particular piece missing. Is there a way I can on mass add in the missing information? Below is an example line from my dataset,
PRIPOS;20150527;EUR;AAAAA;Maxi Dresses;5050300000000;22200000;Thyme;Thyme;6;32;AAAAAA MAXI DRESS;AAAAAA MAXI DRESS;2;All AAAAA Products;000;Dresses;100;Maxi Dresses;10000;Soft Maxi Dress;000.00;00.00;;;;;SS15;;;Insert;;
The first bold field (32) need to be considered the second bold field (insert) is where data needs to be added. The 32 represents a size and the Insert should represent a different size. file contains around 7k lines, all different information.
Is there a particular text editor that will allow me to use a wildcard on a replace function, or an ideas on a script? Failing this I would assume dumping into a SQL table and updating via query would be the quickest method?
Thanks a lot.
You could load into Excel and do a formula on the insert column that looks at the 11th column and based on that sets it's value. Set your list separator character to a semi-colon in the regional settings first.
I am in the process of a migration between CMS and the old forum I used embedded attachments using [attachment=attachment#]imageURL[/attachment] and I want to update this where it changes the old attachment tags into [img][/img]
Getting the [/img] tag replaced was easy given that it's a single string. But my problem is that there is a unique numerical value with a range from 1-4000 in the first part of the shortcode eg: [attachment=3789]picture.jpg[/attachment]
Is there a way for me to run a similar replace query that either ignores all the numbers in the first tag and just replaces it, or perhaps something that removes the entire number rage within that part of the string.
I am unable to replace all numerical ranges in that field because the image names may have numerical values in them, so it will need to replace the numerical range only within that tag.
I have the following data in TableA...
ID | Text
---------------------------------------------
1 | let's find this document
2 | docments are closed
...and if I do the following select...
select Text from TableA where Text like '%doc%';
...I seem to get a strange result. Both rows are returned. With this select, should it not only return row 1? I would have thought that..
select Text from TableA where Text like 'doc%';
...would have returned just row 2. Am I missing something?
What I'm trying to do is run 3 separate searches across this data as part of my searching tool. The first match is to look for the specified pattern "doc" at the beginning of a string, secondly, my next match looks for the same pattern but at the end of a string, and thirdly, identify if the pattern appears anywhere within the text - so can have text surrounding it. Ideally, the first search would only match row 2, the second search would return no results and the third result would only return row 1.The reason for doing it like this is I wanted to try and get a feel for how the pattern matched the string. Would make it easier to read the results to know that the pattern for a given row matched either (a) at the beginning, (b) at the end, (c) anywhere in the middle.Had thought about using regexp, but my data is unicode.
No, the first query returns both rows, because % means 0 or more characters. So if doc is the first thing appearing in the field, it matches the %doc% pattern as well.
But you're right on the second query, it will only return row 2.
doc_% should match it at the beginning, having at least one character after it.
%_doc should match it at the end, having at least one character before it.
%_doc_% should match it anywhere, having at least one character before and after it.
Note that these strict criteria fail to find the exact string "doc", i.e. with nothing before or after it. You may want to include this case in, say, query #1, by loosening it:
doc% should match it at the beginning, having any number of characters after it.