Consider a login scenario in which we send a login HTTP request. Suppose that there is parameter in the response of this request and we want to extract and use this parameter later on. So in this case we will need Post-processor (regular expression extractor). It is most commonly used post-processor in JMeter.
Official JMeter documentation mentions that Post Processors are applied after samplers. They are applied to all the samplers in the same scope, so to ensure that a post-processor is applied only to a particular sampler, add it as a child of the sampler.
Similarly, if we want to run some java code after any specific sampler (request) then we can add bean-shell post-processor under our sampler. For example we extracted a value from response and now we want to multiply it by 2. So we will first add a post-processor regular expression extractor and next we will add bean-shell post-processor.