Comments (23)
@htcfreek I would. But, I would take a little more time than regular devs, since it's my first time working on this module. Hope it's fine.
from powertoys.
@GhostVaibhav
Regarding the ToDos: We also have to update the split code to use the same regex.
And a small not about testing: You have to build the whole PowerToys solution.
from powertoys.
@htcfreek, I have no idea about this stuff, as I'm still very new. But, I think this should be a separate issue since it is no where related to this issue.
from powertoys.
Doesn't the issue mentioned here just revolve around the parsing?
You are true. We can do the hashtag fix thing in another PR.
If your code is ready to create a PR I suggest to open it. If the core team asks for the hashtag handling/fixing we can add it.
from powertoys.
Blocked by the rework of the parser (#33165 , #33085).
from powertoys.
Possible solution using regex:
@",(?=[^""]*(?:""[^""]*""[^""]*)*$)"
Thanks to @GhostVaibhav.
from powertoys.
Hi @htcfreek, if this is a small one, maybe I could help and open a PR quickly.
from powertoys.
Hi @htcfreek, if this is a small one, maybe I could help and open a PR quickly.
@GhostVaibhav
The problem here is the correct regex. We didn't figure it out yet. But your help is welcome.
from powertoys.
@htcfreek, I think your regex is working fine.
from powertoys.
@htcfreek, I think your regex is working fine.
@GhostVaibhav
What happened if the comma is in the first data string. I imagine that the regex os failing then.
Another thing might be escaping the "
with ""
.
from powertoys.
@htcfreek For the first data string, it's passing. But for escaping with double quotes, it's failing.
from powertoys.
@htcfreek I think I found the exact implementation you're looking for.
https://stackoverflow.com/a/769713/12634085
from powertoys.
But for escaping with double quotes, it's failing.
The last test line is wrong. It should not end with a "
or you need """
instead of ""
. Because your test line has a closing bot no opening "
in the last data element.
from powertoys.
So, if we take that into consideration, it is passing.
from powertoys.
Not sure if my regex (found with copilot) is the same as yours but it seems to work:
,(?=(?:[^""]*""[^""]*"")*[^""]*$)
We can add an additional check if the number of "
can be divided by 2. => The no "
is missing.
from powertoys.
@htcfreek all the regexes mentioned in this thread are passing all the checks.
from powertoys.
@GhostVaibhav
Do you like to work on it? Should be easy to implement:
- Update counting code to use the regex, and only match on equal count.
- Add check for
"
sign count. - Update logic that selects the delimiter, that it selects the one with the same count in first and second line.
The file to update is <Advanced Paste Module>/Helpers/JsonHelper.cs
from powertoys.
@GhostVaibhav
I found a way to remove/replace the quotation marks in csv code to get correct json version.
Example:
csv code: "my ""text"""
json code: my ""text""
json imported: my "text"
This requires the two following action in correct order: First remove single marks, then replace other ones.
1. remove: ^""(?!"")|(?<!"")""$|^""""$
- First and last sign if single " AND only two "
2. replace by single ": ^""{3}(?!"")|(?<!"")""{3}$|""{2}
- first three* OR last three* OR pairs of two (* if not more than three)
Do you think this should be an extra issue/pr or does it make sense to implement with escape handling?
from powertoys.
Hi @htcfreek, is the result ok?
from powertoys.
Hi @htcfreek, is the result ok?
@GhostVaibhav
Looks good. Can we try to add additional " handling code:
1. (RegexReplace by empty string): ^""(?!"")|(?<!"")""$|^""""$
=> Remove first and last sign if single " or empty data set like `""`.
2. (RegexReplace with single "): ^""{3}(?!"")|(?<!"")""{3}$|""{2}
=> Replace first three* OR last three* OR pairs of two. (* If not more than three)
The regex replace command need to be applied to each data element in the correct oder. The correct order would be: First replace with empty string and the replace with single ".
from powertoys.
@htcfreek, are you saying this in reference to the correct JSON representation or parsing of the whole string in general?
from powertoys.
@htcfreek, are you saying this in reference to the correct JSON representation or parsing of the whole string in general?
Well I think correct parsing means to not have technical/format caused to many " in the converted output.
The regex would be applied when generation the json result.
from powertoys.
Doesn't the issue mentioned here just revolve around the parsing?
from powertoys.
Related Issues (20)
- Can't remap Win+Shift+S
- fails to restart after closing HOT 2
- awake not showing in taskbar HOT 2
- Add "Keep awake until Restart" option to Awake HOT 2
- Keyboard chatter blocker HOT 3
- VpnHotspot HOT 4
- Something went wrong. HOT 1
- Move current window to a specific desktop HOT 2
- The service feature of Borderless Mouse and the shared pasteboard do not work at the same time.
- Fancy Zones using one zone across both displays HOT 2
- Fancy zones: Window gets snapped to different zone when clicked. Better discrimination between click and drag needed. HOT 1
- a PowerRename bug with input method
- [Color Picker] Preferred monitor position?
- The update requires a D drive ?
- PowerToys Run search bar with squared corners
- PowerRename ignores greek letter "ς" (final sigma) in formatting, when changing beween lower and upper case
- Power Toys Color Picker HOT 2
- FancyZone layout editor not covering full screen HOT 1
- Wrong Number of Args: 0 HOT 2
- Random crash - screen blank while using application HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powertoys.