i have this text
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
58.0.3029 Copyright 2011 Google Inc.
I want is to find everything but
58.0.3029
I use this to find the pattern
\d+(\.\d+\.\d+)
So I have to find all but, the closest I could make was this
[\D+]+([\.\D+][\.\D+])
but it excludes other numbers 5.8 and 2011 too which I don't want to happen
Can you help me to find the right regex for that?
I use http://www.regexpal.com/ to test
I'm using a tool that's been developed with C#
Use anchors (in multiline mode):
^\d[\d.]+
# match the start of the line
# require one digit
# followed by digit(s) and dot(s)
And replace the found match with ''. See a demo on regex101.com.
To get everything but the version number:
([\s\S]*)\b(\d+\.\d+\.\d+)\b([\s\S]*)
Replace with: $1$3
Regex101 Demo
Output:
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
Copyright 2011 Google Inc.
If you want to capture everything but the version number, you can use the following:
([\s\S]*)\b\d+(?:\.\d+){2,}\s*([\s\S]*)
Regex101 Example
Related
I want to fetch the year information from the MBR. Here is my approach for this problem.
For any program, whenever we use 'version' flag we get the year information also. I gues it is the release year of that tool.
For example,
ls --version
ls (GNU coreutils) 8.25
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Richard M. Stallman and David MacKenzie.
Q1. Does the MBR contain the year's info?
Q2. If yes, How I can fetch it?
I can fetch the version info like this
read the first 512 bytes, seek the offset(0x3E) and read the next 2 chars.
Can anyone help me with this?
As you know in build 2016 conference, next version of visual studio was introduced as Visual Studio Enterprise “15” Preview. I downloaded ISO of this preview to check out C# 7.0 new features. As was said in C# presentation session on build conference, I added __DEMO__ and __DEMO_EXPERIMENTAL__ conditional compilation symbols to my project. Now I got these features working:
Local Functions
Digit Separators
Binary Literals
Pattern Matching
But these two do not working and build fails with errors:
Ref Returns and Ref Locals
Tuple Literal Syntax
Can you help me why I can not test these two last feature?
As of today, April 12, 2016 # 12:16 PM (CDT) the tuple feature is in its "prototyping" phase and not yet available. This is regardless of the conditional compilation symbols. Please check out the Roslyn language feature status for details on C# 7.0.
Actually, in looking more closely at the list -- it seems as though pattern matching is in "prototyping" too, which means I must stand corrected. If that is the case, then you should be able to pull down the Roslyn compiler locally from the tuple branch found here. Then use this build to compile your experimental code as defined here.
Visual Studio 15 Preview will only let you play with some of the proposed features of C# 7.0, more specifically:
local functions
digit separators
binary literals
ref returns
and pattern matching
Basically the stuff you already mentioned. Here is the source. It's unclear when the others will be made available.
I know I can use any of the scripting languages for it that is perl, python etc... but this means that I must install big package with all its dependencies while I need only regex feature and second I want it to be fast and portable, that is only regex engine and sdt streams compiled into the application, nothing more. Is there anything like it ?
How about using:
Sed for Windows part of the GnuWin package
or UnxUtils which also includes Sed
Both are light and fast. Both have dependencies but light ones.
vbscript and powershell have native regex function and is part of windows dependeing version of it.
but this means that I must install big package with all its dependencies
How big is the package (binaries on 64bit Windows), used space on HDD:
Perl 109 MiB This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x64-multi-thread (ActiveState)
php 48 MiB PHP 5.5.5 (cli) (built: Oct 15 2013 11:47:27)
Python 48 MiB Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64 bit (AMD64)] on win32
Yes, there is program that does exactly what I was looking for:
https://sites.google.com/site/regexreplace/ - rxrepl, Regular Expression Search and Replace Command Line Tool, Version 1.3
> java -version
java version "1.7.0_10-ea" <---- !
Java(TM) SE Runtime Environment (build 1.7.0_10-ea-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)
Am I running the last JDK 7u10 please ?
EA stands for "Early Access", EA is a preview release for the upcoming version of the software.
Checkout this link:-
EA release
EA stands for "Early Access", EA is a preview release for the upcoming
version of the software. This release may contain many new features
and bug fixes and as a preview may contain some unexpected issues. It
is not recommended that this preview release be used in a production
environment. Please upgrade to the latest release on java.com
On a side note:-
There are two more releases:-
OEM release
OEM stands for "original equipment manufacturer". An early version of
Java 1.6.0-oem was provided to OEMs. The OEM term will not be used in
subsequent releases of 1.6. Please upgrade to the latest release on
java.com
Beta release
A beta release is a 'stable' preview release which is tested for bugs.
Beta releases are often made available to the general public to
download and test. Please upgrade to the latest release on java.com
-ea stands for "early access":
http://java.com/en/download/faq/oem.xml
EA stands for "Early Access", EA is a preview release for the upcoming version of the software. This release may contain many new features and bug fixes and as a preview may contain some unexpected issues. It is not recommended that this preview release be used in a production environment. Please upgrade to the latest release on java.com
How to differentiate between .NET DLL and C++ dll without looking at the code. Can we identify it by looking at the export table or other section of DLL after looking into DLL from any PE file explorer?
You might be able to use corflags
For a .NET c# DLL I get
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Version : v4.0.30319
CLR Header: 2.5
PE : PE32
CorFlags : 1
ILONLY : 1
32BIT : 0
Signed : 0
For a C++ DLL I get
corflags : error CF008 : The specified file does not have a valid managed header
**** UPDATE ****
I might have misunderstood the question. This is a good SO question on a similar problem. How can I test a Windows DLL file to determine if it is 32 bit or 64 bit?
As a matter of fact, this is clearly indicated by looking at the Image file and is documented by the Portable Executable format specification. Should the Directory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR] be present (not EMPTY), the image is Managed (.NET) otherwise the image is unmanaged.