Is it possible to detect a programming language source code (primarily Java and C# ) in a text?
For example I want to know whether there is any source code part in this text.
.. text text text text text text text text text
text text text text text text text text text
text text text text text text text text text
public static Person createInstance() { return new Person();}
text text text text text text text text text
text text text text text text text text text
text text text text text text text text text ..
I have been searching this for a while and I couldn't find anything.
A solution with Python would be wonderful.
Regards.
Press the Ctrl+N keys. Alternatively, right-click in the source code area, and from the pop-up menu, click Find Next. The source code scrolls if necessary, and the matching text is highlighted.
JavaScript Encryption This is by far the most popular way to try to hide one's source code. It involves taking your code, using a custom made function to “encrypt” it somehow, and then putting it in an HTML file along with a function that will decrypt it for the browser.
There are some syntax highlighters around (pygments, google-code-prettify) and they've solved code detection and classification. Studying their sources could give an impression how it is done.
(now that I looked at pygments again - I don't know if they can autodetect the programming language. But google-code-prettify definitly can do it)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With