G
G
game8022016-09-19 21:22:24
React
game802, 2016-09-19 21:22:24

What regex to use in php?

Good afternoon dear experts! I would like to ask you a question about a regular expression.
I do not quite understand how to implement the removal of characters I do not need.
I have a code:
$str = substr($filename, strlen('Subject(*)'));
I have files:
1. Subject(Fwd_ CASTORLAND Price list September 2016)_Price Castorland September-2016!!!NEW+Darts!!!1.xlsx
2. Subject(Fwd_ Atberg 98, price)_Price dated 12.09.16.xls
....
I write something like strlen('Subject(*)'), but only the first parenthesis and the first letter are removed. How can I remove everything inside the brackets along with Subject.
Example: Before
: Subject(Fwd_ Atberg 98, price)_Price from 12.09.16.xls Now
: Price from 12.09.16.xls
And so that, even after the bracket (the last one), the symbol _
is deleted Thank you very much for your help!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2016-08-30
@Pogran

Are you using webpack?
The error is most likely in the wrong connection of the file with the code (bundle.js usually). Such an error usually looks like this in the console . More details here .
I can’t answer the question more precisely without the server startup code, and the webpac-dev-server code and webpack-config files may also come in handy.

I
Ilya, 2016-09-19
@game802

Good afternoon.
As far as I'm concerned, here's what might work:

preg_replace('/Subject\(.*\)_/i', '', $str); // где $str - имя файла

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question