Closed shiralizadeh closed 2 years ago
@shiralizadeh :( see #124
You will need to use a PCRE-compatible syntax. https://github.com/firasdib/Regex101/issues/124#issuecomment-55915837
+1 also need !
As with all the other requests for more flavors, there's not much I can do right now.
+1 It's sad I can't use patterns like "(?<=(.*?))HELLOWORLD", while .NET supports this.
.NET still has the best RegEx engine.
I needed to use named capturing groups and .Net has different syntax for it. I had to use http://regexstorm.net/tester and it is not comparable-RegEx101 is significantly user friendlier. Having .Net flavor will be very useful.
This would be a very welcomed feature! š
What is hindering you form adding support for the .net regex engine? You have multiple options for running .net under non windows environments if thatĀ“s the problem.
@AnderssonPeter engines are currently all client-side, so only JS would be considered IMO. @firasdib https://github.com/bridgedotnet/Bridge/tree/master/Bridge/Resources/Text/RegularExpressions package looks good. With a bit of work (namely implementing Bridge.define) it may be useful.
The variable-width lookbehind support in .NET is very useful and not easy to imitate using PCRE.
Has the variable width look-behind been made easier to implement maybe, now that python regex also supports it?
Would love a C# flavor - this is the best RegEx site I've found, but unfortunately I can't always use it with C#.
I concur here, this is clearly my favourite Regex online tool and would love to have full C# support. Thanks for your hard work!
If it at least could support copy/paste to c# it would be extremely helpful
+1, Best regex site, would be amazing if it had the C# regex flavor!
I use regexhero for .Net, but an online version would be great. +1 for a .Net (C#) flavor :)
Ah. +1
+1 referencing named groups is shown in here as \g but for .NET it is \k. There are other small differences that it would be handy to be able to know/learn/lookup.
There are other small differences that it would be handy to be able to know/learn/lookup.
This resource can help you with that: https://www.regular-expressions.info/dotnet.html
engines are currently all client-side, so only JS would be considered IMO.
With WebAssembly (and Mono-Wasm in particular), this theoretically changes. This is clearly in early stages and a lot of overhead, but might be something to be considered for the long run.
@chucker If you can create a POC with wasm, I'd be more than happy to implement it.
@chucker the ball is on your side buddy š¬
Iāll see when I can get around to it.
@chucker I have a few days off, if you're up for it, we can work on this together.
If you can create a POC with wasm
How far does this POC need to go? Are there APIs of sorts that I can implement?
@chucker For the POC I just want a hello world executing a simple regex, it can even be hard coded. As long as we can see it works.
@firasdib ok, got caught up in some other stuff, but https://github.com/chucker/monowasm-regex-poc is exactly that. Check out the readme.
@chucker Thank you very much. If you have time, please drop by IRC so we can have a chat about how to best integrate the .NET engine into the website.
I saw a note earlier about the mono implementation of regex having issues. Just wanted to point out that according to the mono team, they consider their own implementation of regex to be "buggy, poorly maintained or a source of problems", and plan to entirely replace their code with the source code from .net core. So given a choice to develop with mono/webassembly or .net core/webassembly, I'd suggest the .net core version.
Source: https://www.mono-project.com/docs/about-mono/dotnet-integration/
.Net Core in the browser is in preview by Microsoft (the Blazor project) planned to be officially released after .Net Core 3.0 later this year.
https://dotnet.microsoft.com/apps/aspnet/web-apps/client
https://devblogs.microsoft.com/aspnet/blazor-now-in-official-preview/
I've been a hardcore user of mono's regex, and a regex as simple as the one being mentioned here, I highly doubt will fail. :?
On Mon, May 27, 2019 at 2:41 AM Shane32 notifications@github.com wrote:
I saw a note earlier about the mono implementation of regex having issues. Just wanted to point out that according to the mono team, they consider their own implementation of regex to be "buggy, poorly maintained or a source of problems", and plan to entirely replace their code with the source code from .net core. So given a choice to develop with mono/webassembly or .net core/webassembly, I'd suggest the .net core version.
Source: https://www.mono-project.com/docs/about-mono/dotnet-integration/
ā You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/firasdib/Regex101/issues/156?email_source=notifications&email_token=AABOV6LLY4H6MRFOMWLGYNLPXMU5HA5CNFSM4AWGEDY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWIQX2Q#issuecomment-496045034, or mute the thread https://github.com/notifications/unsubscribe-auth/AABOV6ISNZRRXFDQHWZYGLLPXMU5HANCNFSM4AWGEDYQ .
So given a choice to develop with mono/webassembly or .net core/webassembly, I'd suggest the .net core version.
The problem is CoreRT is not as far along.
As for the original comment, Iām not sure why it was deleted, but it seemed to be a simple coding error, setting regex options and then not actually using them.
the Blazor project
Blazor is an SPA framework like Angular or React. The underlying WebAssembly integration comes from Mono and is what my PoC builds upon.
Sorry for the false alarm friends. I had made a typo in the code, and was too tired to notice it. I deleted the comment to not confuse others, but it seems everyone got an email notification :-)
Personally, I'd be happy if the site simply converted the C# escaping into javascript escaping and ran the regex string within javascript, so you can copy and paste between the website and C#. Maybe throw an error for known tokens that are unsupported in the C# flavor. Anything more would be a bonus (like using mono/.net to actually test the regex string with).
Could someone help me compile a list of the differences between the .NET engine and say JS and PCRE?
This will aid a lot in writing the regex parser for the language, and save me a lot of trial and error.
This site has a pretty well-document list of token differences between any flavor, including Javascript and C#: https://www.regular-expressions.info/refcharacters.html
Status update
The good: .NET is now almost entirely integrated into the website. I need to finish adding substitution and quickref, and fixing minor bugs in the parser. Otherwise things are looking very good.
The bad: when compiling mono, it outputs 23 dlls that are required to be downloaded (along with the js+wasm code), which totals to around 16mb. This is far from ideal, and I'm not sure what can be done to reduce the file sizes and/or the amount of dlls.
Any ideas?
I know it's Android, but could help you: https://stackoverflow.com/a/13352758/253468 ProGuard is tree-shaking and minifier for Java. I guess you need the equivalent for .NET assemblies which above SO answer seems to provide.
@TWiStErRob Tree shaking might definitely help. No idea how that works here though. I also believe I need to use AOT compilation to get rid of all the dlls, but the size of the resulting file might be the same.
@chucker Do you have any idea?
Any ideas?
Yes ā you want to run the linker. https://github.com/dotnet/core/blob/master/samples/linker-instructions.md
This will more aggressively do dead code elimination and should get you down to about 2 MiB. In addition, if you want to reduce files, you may be able to combine this with ILMerge, but Iām not sure if that will work in this scenario.
As for AOT, thatās also an option (though primarily for performance reasons), but sort of experimental at this point (for example, Blazor doesnāt offer it out of the box yet).
@chucker Thanks for the link. I'll see if I can manage to get that working. If you have some time over, I'd love the help.
As for performance, this is the statistics I've managed to gather so far:
Running the regex /./g
on a string of 10,000 characters:
So its definitely not fast, but it might be better after I get the linker working.
@chucker For a novice like me, this wasn't all too straight forward. I don't know how to proceed from here. I'm running OSX, if that matters.
The .NET engine is integrated into the website now, and this basic POC works just fine. However, I need help with improving the performance of the library and reducing its size. I have not been able to do it myself yet.
If anyone can help, that'd be greatly appreciated. The faster we can get that sorted, the faster you guys can start using .NET on regex101.com :-)
Bump. Anybody who can help? The release of .NET hinges only on this right now.
@chucker You seem quite knowledgable. Do you know how I can create an optimized version of the library?
I saw your comment but canāt devote time at this point. Maybe in a week or two.
Reducing footprint is doable. Improving performance may be best to revisit in another year or so, when Monoās AOT efforts are more stable.
@chucker I'd be happy with just reducing the footprint, as a first step. Any help you can provide is much appreciated. Feel free to message me at any time.
@chucker Have you had time to get around to it?
Not yet, sorry. Hopefully this weekend.
Not having .NET regex engine on the best online regex testing online platform feels just like a joke. Please we're waiting for it!
P.S. it doesn't have to be the .NET engine, it just needs to behave like such reference link
@L4ZZA I'll be working on it some more in the coming weeks.
I'm still hoping that @chucker will have some time to look into it, but if not, I might still release the large version of the library and evaluate how it goes.
@firasdib see if this helps https://www.hanselman.com/blog/ExperimentalReducingTheSizeOfNETCoreApplicationsWithMonosLinker.aspx
I'm still hoping that @chucker will have some time to look into it
Can't make any promises, but would still love to see this.
I've been trying to build the mono repo according to the documentation here (https://github.com/mono/mono/tree/master/sdks/wasm) and experiment with the linker, but so far I haven't been able to build it. I keep getting errors related to OSX, even though I am running this on Linux (such as Xcode not being installed).
Not sure what to do with this. I could release the current version I have locally, but that has 15mb dll-dependencies that each user will have to download, which are quite suboptimal (both from performance, but also the servers bandwidth limitations).
@chucker Any chance we can have a short chat some day and try to work this out?
Hi regex101, Can you add C# to your Flavor section? If you want I can help you for this.
Thanks, Shiralizadeh